通过 ElasticSearch DSL python 包装器创建索引时如何在索引级别设置 ignore_malformed?

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

根据docs,这应该足够了:

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

但是我怎样才能在 python 包装器上实现这个呢?我当前的代码如下所示:

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()

令人惊讶的是,

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

工作完美。我会把 Q 留在这里,因为可能会有用。