[英]elastic search does not obey mapping when update adds a new field
Using python update API I add a string field to my ES indexed documents. 使用python update API,我向我的ES索引文档中添加了一个字符串字段。 Even my mapping has this:
甚至我的映射都有:
"mappings" : {
"_default_": {
"dynamic_templates": [
{ "notanalyzed": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
},
the newly added field is still analyzed. 新添加的字段仍在分析中。 Anybody noticed the same problem?
有人注意到同样的问题吗?
Here a piece of python code that adds the new column: 这是一段添加新列的python代码:
res = es.search(index=ind, body=st, size=2000) for rec in res['hits']['hits']: es.update(index=rec['_index'],doc_type=rec['_type'],id=rec['_id'], body={"doc": {"srcSite": sS}})
So the newly added "srcSite" is still somehow "analyzed". 因此,仍会以某种方式“分析”新添加的“ srcSite”。 I have tried to add the new field explicitly into the template but that did not help either.
我试图将新字段显式添加到模板中,但这也没有帮助。
Ah, I found what was the problem. 啊,我发现了问题所在。 It appears that the template somehow gets fixed at the time a document was created and changing the template later will change nothing - even if one updates the document it won't use the changed template but an original one...
看来模板在创建文档时会以某种方式固定,以后再更改模板也不会改变-即使更新文档,它也不会使用更改后的模板,而是使用原始模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.