[英]Mapping Elasticsearch with Python
I have JSON docs (referred to below as "file_content") that have strings that I want all set to not_analyzed. 我有JSON文档(以下称为“ file_content”),其中包含我希望全部设置为not_analyzed的字符串。 I am trying to accomplish this as such:
我正在努力做到这一点:
if not es.indices.exists(index='telemfile'):
es.indices.create('telemfile') # Create the index to work with
namapping = {
"mappings": {
"telemetry_file": {
"dynamic_templates": [{
"string_fields": {
"match": "*",
"match_mapping_type": "string",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}]
}
}
}
es.indices.put_mapping(index='telemfile', doc_type='telemetry_file', body=namapping)
es.index(index='telemfile', doc_type='telemetry_file', body=file_content)
but I get the following error: MapperParsingException[Root type mapping not empty after parsing! 但出现以下错误:MapperParsingException [解析后的根类型映射不为空! Remaining fields: [mappings : {telemetry_file={dynamic_templates=[{string_fields={mapping={type=string, index=not_analyzed}, match=*, match_mapping_type=string}}]}}]];
其余字段:[mappings:{telemetry_file = {dynamic_templates = [{string_fields = {mapping = {type = string,index = not_analyzed},match = *,match_mapping_type = string}}}}]]]] Can anyone tell me what I am doing wrong?
谁能告诉我我在做什么错?
我从上面删除了“映射”:对象,并且它可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.