我需要帮助,而试图添加忽略\u格式错误到我的索引设置。
我有:
from elasticsearch import Elasticsearch
es = Elasticsearch(
[{'host': 'localhost', 'port': 9200}])
index_name = 'product'
settings = {
"settings": {
"index.refresh_interval" : "1s",
"index.mapping.total_fields.limit": 10000,
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"properties": {
"location": {
"type": "geo_point"
}
},
"dynamic_templates": [
{
"strings_as_keywords": {
"match_mapping_type": "string",
"mapping": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
]
}
}
es.indices.create(index=index_name, body=settings)
如果我尝试添加“index.mapping.ignore\u malformed”:true,我得到:nameerror:没有定义名称“true”
通过以下操作,我可以执行此设置,但在索引时需要同时执行这两个设置:
from elasticsearch import Elasticsearch
# conntect es
es = Elasticsearch(
[{'host': 'localhost', 'port': 9200}])
from elasticsearch_dsl import Index
index_name = 'product'
index = Index(index_name, es)
index.settings(
index={'mapping':{'ignore_malformed':True}}
)
index.create()
在kibana的“编辑设置”下,我当前的索引规格是:
{
"index.blocks.read_only_allow_delete": "false",
"index.priority": "1",
"index.query.default_field": [
"*"
],
"index.write.wait_for_active_shards": "1",
"index.mapping.total_fields.limit": "10000",
"index.refresh_interval": "1s",
"index.number_of_replicas": "0"
}
如何在创建索引时合并上述内容以获得:
{
"index.blocks.read_only_allow_delete": "false",
"index.priority": "1",
"index.query.default_field": [
"*"
],
"index.write.wait_for_active_shards": "1",
"index.mapping.total_fields.limit": "10000",
"index.refresh_interval": "1s",
"index.mapping.ignore_malformed": "true",
"index.number_of_replicas": "0"
}
旁边:在kibana result=bad request(wtf why!?)中编辑也不可能添加这个字符串
引用:elasticsearch日期字段中的空字符串?
在通过elasticsearch dsl python wrapper创建索引时,set ignore\u在索引级别的格式有多不正确?
谢谢你的帮助
1条答案
按热度按时间bwntbbo31#
哦,是的,打字错误。。。我重新修改了设置,现在它可以工作了,甚至在现场级别:)