无法配置索引的同义词

ni65a41a  于 2021-06-09  发布在  ElasticSearch
关注(0)|答案(1)|浏览(451)

我想配置 synonym 用于索引;通过 Elasticvue 我运行这个:

HTTP method : PUT , Path : /my_index

Request body :

{
    "settings": {
        "index": {
            "analysis": {
                "analyzer": {
                    "synonym": {
                        "tokenizer": "whitespace",
                        "filter": [
                            "synonym"
                        ]
                    }
                },
                "filter": {
                    "synonym": {
                        "type": "synonym",
                        "synonyms_path": "synonym.txt"
                    }
                }
            }
        }
    }
}

结果:

{
    "error": {
        "root_cause": [
            {
                "type": "resource_already_exists_exception",
                "reason": "index [my_index/F5AydksvQy2hzXNV1BnyWg] already exists",
                "index_uuid": "F5AydksvQy2hzXNV1BnyWg",
                "index": "my_index"
            }
        ],
        "type": "resource_already_exists_exception",
        "reason": "index [my_index/F5AydksvQy2hzXNV1BnyWg] already exists",
        "index_uuid": "F5AydksvQy2hzXNV1BnyWg",
        "index": "my_index"
    },
    "status": 400
}

那么如何解决这个问题呢?

tzxcd3kk

tzxcd3kk1#

首先需要删除索引,然后使用新的索引设置再次创建索引。
你得到了错误 resource_already_exists_exception 因为您试图在旧索引仍然存在的情况下创建索引。

相关问题