標籤:報錯 setting lower min 支援 number 網上 analysis efi
報錯日誌:
網上寫elasticsearch也有很多文章,都寫的挺好的,目前想把錯誤記錄檔以及解決方案寫出來,希望一些小夥伴能儘快躲開些問題,把時間花在一些有用的事情上。
錯誤記錄檔{"error": {"root_cause": [{"type": "mapper_parsing_exception","reason": "analyzer on field [word] must be set when search_analyzer is set"}],"type": "mapper_parsing_exception","reason": "Failed to parse mapping [doc]: analyzer on field [word] must be set when search_analyzer is set","caused_by": {"type": "mapper_parsing_exception","reason": "analyzer on field [word] must be set when search_analyzer is set"}},"status": 400}
建立索引的條件:
{ "settings": { "number_of_shards": 1, "analysis": { "filter": { "ngram_filter": { "type": "ngram", "min_gram": 2, "max_gram": 20 } }, "analyzer": { "ngram_analyzer": { "type": "custom", "tokenizer": "standard", "filter": [ "lowercase", "ngram_filter" ] } } } }, "mappings": { "doc": { "_all": { "type": "text", ** "index_analyzer": "ngram_analyzer",** "search_analyzer": "standard" }, "properties": { "word": { "type": "text", ** "index_analyzer": "ngram_analyzer",** "search_analyzer": "standard" }, "definition": { "type": "text" } } } }}
為什麼呢?因為mappings裡有寫參數在elasticsearch5版本裡不支援了,index_analyzer就不支援了,改成了analyzer,改過來,就好了,可以建立索引成功。
【Elasticsearch問題1】建立索引的時候報mapper_parsing_exception