Error log:
Online write Elasticsearch also have a lot of articles, are written very good, now want to write the error log and solution, I hope some small partners can avoid some problems as soon as possible, spend time on some useful things.
错误日志{"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}
Criteria for indexing:
{ "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" } } } }}
Why is it? Because mappings in the ELASTICSEARCH5 version of the write parameters are not supported,Index_analyzer will not support, changed to the analyzer, change over, just fine, you can build the index success.
"Elasticsearch Issue 1" is indexed mapper_parsing_exception