我能够创建索引1乘1,但我的目的是有一个大索引和子索引进行搜索。(我正在复制一个现有的应用程序,但升级依赖项)
Symfony : 5.4* FOS-Elastica : 6.1弹性: 7*
这是我的错误信息,如果我将类型更改为属性,则会出现类似的错误。我一整天都在尝试以不同的方式切换和缩进:
Unrecognized option "types" under "fos_elastica.indexes.app". Available options are "_id", "_routing", "_source", "analyzer", "client", "date_detection", "dynamic", "dynamic_date_formats", "dynamic_templates", "finder", "index_
name", "index_prototype", "indexable_callback", "numeric_detection", "persistence", "properties", "serializer", "settings", "use_alias". ,请问我做错什么了?
#app/config/config.yml
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
app:
settings:
analysis:
analyzer:
fr:
tokenizer: standard
filter: [ lowercase, stop_fr, snowball_fr ]
autocomplete:
type: custom
tokenizer: whitespace
filter: [ lowercase, engram, elision ]
csv:
type: pattern
pattern: '\s*,\s*'
lowercase: false
filter:
snowball_fr:
type: "snowball"
language: "French"
stop_fr:
type: "stop"
stopwords: "_french_"
engram:
type: edge_ngram
min_gram: 2
max_gram: 15
types:
# ---------
# USER
# ---------
user:
properties:
username: ~
email: ~
organization:
type: object
properties:
id: { index: true }
code: { index: true }
name:
index: true
type: text
fields:
source: { type: text, index: true }
persistence:
driver: orm # orm, mongodb, propel are available
model: App\Entity\User
provider: ~
listener: ~
finder: ~发布于 2022-03-02 14:07:20
因此,我也在研究如何处理与您相同的问题,我确实确认了很多文档和博客使用了您发布的配置结构。但是,当我回到这个包的v6.1文档时,我是找到这个
动态模板动态模板允许定义在动态引入字段/对象时应用的映射模板。 文档 fos_elastica: indexes: dynamic_templates: my_template_1: match: apples_*映射: type: float my_template_2: match:*match_mapping_type:文本映射: type:关键字属性:用户名:{ type: text }
因此,在您的示例中,工作配置如下所示:
#app/config/config.yml
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
indexes:
user:
settings:
analysis:
analyzer:
fr:
tokenizer: standard
filter: [ lowercase, stop_fr, snowball_fr ]
autocomplete:
type: custom
tokenizer: whitespace
filter: [ lowercase, engram, elision ]
csv:
type: pattern
pattern: '\s*,\s*'
lowercase: false
filter:
snowball_fr:
type: "snowball"
language: "French"
stop_fr:
type: "stop"
stopwords: "_french_"
engram:
type: edge_ngram
min_gram: 2
max_gram: 15
properties:
username: ~
email: ~
organization:
type: object
properties:
id: { index: true }
code: { index: true }
name:
index: true
type: text
fields:
source: { type: text, index: true }
persistence:
driver: orm # orm, mongodb, propel are available
model: App\Entity\User
provider: ~
listener: ~
finder: ~https://stackoverflow.com/questions/71251196
复制相似问题