我使用symfony和fos elastica捆绑包。我尝试像本教程https://www.codevate.com/blog/14-implementing-search-as-you-type-autocomplete-with-elasticsearch-and-symfony中那样添加映射,但得到了这个错误:
Unrecognized option "mappings" under "fos_elastica.indexes.app.types.user"
这是我的配置:
# Read the documentation: https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/Resources/doc/setup.md
fos_elastica:
clients:
default: { host: localhost, port: 9200 }
# indexes:
# app: ~
indexes:
app:
client: default
settings:
index:
analysis:
analyzer:
name_analyzer:
type: custom
tokenizer: standard
filter: [standard, lowercase, asciifolding, elision]
types:
user:
properties:
username: ~
# mappings:
# email: ~
mappings:
username:
type: completion
analyzer: name_analyzer
search_analyzer: name_analyzer
payloads: true
persistence:
# the driver can be orm, mongodb, phpcr or propel
# listener and finder are not supported by
# propel and should be removed
driver: orm
model: App\Entity\User
provider: ~
listener: ~
finder: ~发布于 2019-01-14 18:13:19
fos_elastica配置中没有"mappings“属性。您可以使用以下命令列出所有可能的配置属性:
php bin/console config:dump-reference fos_elastica尝试将mappings更改为properties,并删除上面配置中的空properties密钥。
如果您遇到类似的错误,请尝试使用配置参考或官方文档:
https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/v5.0.3/doc/types.md
https://stackoverflow.com/questions/54179246
复制相似问题