Search code examples
pythonpython-2.7elasticsearchelasticsearch-dslelasticsearch-py

How set ignore_malformed in index level when creating an index through ElasticSearch DSL python wrapper?


According to docs, this should be sufficient:

"settings": {
    "index.mapping.ignore_malformed": true 
  }

But how can I achieve this on python wrapper? My current code looks like this:

from elasticsearch_dsl import Index

index = Index('my_index', my_conn)
index.settings(
     number_of_shards=ES_NUMBER_OF_SHARDS,
     number_of_replicas=ES_NUMBER_OF_REPLICAS
)
index.create()

Solution

  • Surprisingly,

        index.settings(
            index={'mapping':{'ignore_malformed':True}}
        )
    

    Worked perfectly. I'll leave the Q here, since might be useful.