node.js – 新的elasticsearch 2.1.1版本中的mapper_parsing_exception

前端之家收集整理的这篇文章主要介绍了node.js – 新的elasticsearch 2.1.1版本中的mapper_parsing_exception前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
问题:我已经创建了映射,并且它在elasticsearch中工作正常
1.7.1但在更新到2.1.1后,它会给我例外

例外

response: '{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason"
:"analyzer on field [_all] must be set when search_analyzer is set"}],"type":"ma
pper_parsing_exception","reason":"Failed to parse mapping [movie]: analyzer on f
ield [_all] must be set when search_analyzer is set","caused_by":{"type":"mapper
_parsing_exception","reason":"analyzer on field [_all] must be set when search_a
nalyzer is set"}},"status":400}',toString: [Function],toJSON: [Function] }
{
    "settings": {
        "number_of_shards": 1,"number_of_replicas": 0,"analysis": {
            "filter": {
                "nGram_filter": {
                    "type": "nGram","min_gram": 2,"max_gram": 20,"token_chars": [
                        "letter","digit","punctuation","symbol"
                    ]
                }
            },"analyzer": {
                "nGram_analyzer": {
                    "type": "custom","tokenizer": "whitespace","filter": [
                        "lowercase","asciifolding","nGram_filter"
                    ]
                },"whitespace_analyzer": {
                    "type": "custom","asciifolding"
                    ]
                }
            }
        }
    },"mappings": {
        "movie": {
            "_all": {
                "index_analyzer": "nGram_analyzer","search_analyzer": "whitespace_analyzer"
            },"properties": {
                "movieName": {
                    "type": "string","index": "not_analyzed"
                },"movieYear": {
                    "type": "double"
                },"imageUrl": {
                    "type": "string"
                },"genre": {
                    "type": "string"
                },"director": {
                    "type": "string"
                },"producer": {
                    "type": "string"
                },"cast": {
                    "type": "String"
                },"writer": {
                    "type": "string"
                },"synopsis": {
                    "type": "string"
                },"rating": {
                    "type": "double"
                },"price": {
                    "type": "double"
                },"format": {
                    "type": "string"
                },"offer": {
                    "type": "double"
                },"offerString": {
                    "type": "string"
                },"language": {
                    "type": "string"
                }
            }
        }
    }
}

解决方法

如果您问我,则需要在电影映射中为_all指定分析器,这个错误非常清楚.设置index_analyzer已在 Elasticsearch 2.0删除.
"_all": {
            "analyzer": "nGram_analyzer","search_analyzer": "whitespace_analyzer"
        },

猜你在找的Node.js相关文章