通过ElasticSearch DSL python包装器创建索引时,如何在索引级别设置ignore_malformed? [英] How set ignore_malformed in index level when creating an index through ElasticSearch DSL python wrapper?

查看:78
本文介绍了通过ElasticSearch DSL python包装器创建索引时,如何在索引级别设置ignore_malformed?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 docs ,应该足够了:

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

但是如何在python包装器上实现呢?我当前的代码如下:

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

推荐答案

令人惊讶的是,

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

工作完美.由于可能有用,所以我将Q留在这里.

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

这篇关于通过ElasticSearch DSL python包装器创建索引时,如何在索引级别设置ignore_malformed?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆