Elasticsearch 7.17.5索引模板未知设置问题

2wnc66cl  于 2022-12-26  发布在  ElasticSearch
关注(0)|答案(1)|浏览(315)

我正在使用elasticsearch 7.17.5并尝试创建一个索引模板。但是我得到了下面的错误,无法找出是什么问题。
第一个月
这是我的索引模板:

{
    "version": 1,
    "index_patterns": [
        "my-index-template",
        "my-index-template-*"
    ],
    "template": {
        "settings": {
            "index": {
                "number_of_shards": 3,
                "number_of_replicas": 2,
                "max_ngram_diff": 7,
                "mappings": {
                    "total_fields": {
                        "limit": 1000
                    }
                }
            },
            "analysis": {
                ...
            }
        },
        "mappings": {
            ...
        }
    }
}

我已经尝试了错误消息中提供的选项,但仍然没有成功。
而当我尝试基于elasticsearch引用不带's'的“mapping”时,我得到了以下错误:
Caused by: co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch.indices.IndexSettings: Unknown field 'mapping' (JSON path: template.settings.index.mapping) (line no=13, column no=26, offset=326)

x6h2sr28

x6h2sr281#

您正在使用带有s的Map,而实际设置没有使用s,因此您可以通过将其更改为Map来修复使用。
参考设置名称https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-settings-limit.html#mapping-settings-limit

{
    "version": 1,
    "index_patterns": [
        "my-index-template",
        "my-index-template-*"
    ],
    "template": {
        "settings": {
            "index": {
                "number_of_shards": 3,
                "number_of_replicas": 2,
                "max_ngram_diff": 7,
                "mapping": { // Note this
                    "total_fields": {
                        "limit": 1000
                    }
                }
            }
        }
    }
}

这个对我来说很好用

相关问题