我正在尝试使用python API和以下代码构建索引(特别是我正在尝试配置分析器):
doc = {
"settings": {
"analysis": {
"analyzer": {
"folding": {
"tokenizer": "standard",
"filter": [ "lowercase", "asciifolding" ]
}
}
}
}
}
res = es.indices.create(index='index_db',body=doc)
但是,当我尝试使用一些示例数据向数据库提供数据时:“我的食道导致了结皮”(该网站的同一示例),我没有得到:“我的食道引起了崩溃”,但又一次出现了:“我的,“食道引起,débâcle”。我认为问题在于索引的创建。我使用正确的语法吗?
最佳答案
经过几次尝试,我找到了解决方案。这是一个语法问题。
正确答案是:
doc = {
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"tokenizer" : "standard",
"filter" : ["standard", "asciifolding"]
}
}
}
}
}
es.indices.create(index='forensic_db',body=doc)
关于python - Elasticsearch-Python 2.7-为分析器配置索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38416262/