How To Specify Index.mapping.ignore_malformed In Elasticsearch Python Lowlevel Client?
from elasticsearch import Elasticsearch es = Elasticsearch() es.indices.create(index='report', ignore=400) es_reponse = es.index(index='reports',doc_type='text',body=report_json)
Solution 1:
You can create index with this parameter in Python
with:
from elasticsearch_dsl import Index
from elasticsearch import Elasticsearch
es=Elasticsearch(['ES_URL:ES_PORT'])
index = Index('my_index', es)
index.settings(
number_of_shards=6,
number_of_replicas=2,
index={'mapping':{'ignore_malformed':False}}) //orTrue
index.create()
And this is how it looks like on Elasticsearch
:
[root@host]$ curl -XGET ES_URL:ES_PORT/my_index/_settings?pretty
{
"my_index" : {
"settings" : {
"index" : {
"mapping" : {
"ignore_malformed" : "false"
},
"number_of_shards" : "6",
"provided_name" : "my_index",
"creation_date" : "1573646292390",
"number_of_replicas" : "2",
"uuid" : "e__BuX-KSSeoR2LXQXaWkA",
"version" : {
"created" : "6020499"
}
}
}
}
}
Post a Comment for "How To Specify Index.mapping.ignore_malformed In Elasticsearch Python Lowlevel Client?"