我正在尝试使用类型设置为cross_fields
的elasticsearch(版本1.0)多匹配查询,如弹性搜索页面here上的手册所示:
查询看起来像这样(并且它与弹性搜索页面完全相同):
{
"multi_match" : {
"query": "Robert Smith",
"type": "cross_fields",
"fields": [ "vorname", "familienname" ],
"operator": "and"
}
}
使用jdbc river(带自动映射)插件创建索引,并与其他查询一起正常工作。当我删除类型:cross_fields
或将其更改为例如phrase_prefix
时,它正常工作。当我将其更改为most_fields
之类的其他类型时,它也无法正常工作。我得到的错误看起来像这样:
{
"error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[WXL5tNBeQB6tW0xLDPURRA][df_smsdata][3]: SearchParseException[[df_smsdata][3]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"multi_match\":{\"query\":\"Robert Smith\",\"type\":\"cross_fields\",\"fields\":[\"vorname\",\"familienname\"]}}}]]]; nested: QueryParsingException[[df_smsdata] **[multi_match] query does not support type cross_fields];** }{[WXL5tNBeQB6tW0xLDPURRA][df_smsdata][2]: SearchParseException[[df_smsdata][2]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"multi_match\":{\"query\":\"Robert Smith\",\"type\":\"cross_fields\",\"fields\":[\"vorname\",\"familienname\"]}}}]]]; nested: QueryParsingException[[df_smsdata] [multi_match] query does not support type cross_fields]; }{[WXL5tNBeQB6tW0xLDPURRA][df_smsdata][4]: SearchParseException[[df_smsdata][4]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"multi_match\":{\"query\":\"Robert Smith\",\"type\":\"cross_fields\",\"fields\":[\"vorname\",\"familienname\"]}}}]]]; nested: QueryParsingException[[df_smsdata] [multi_match] query does not support type cross_fields]; }{[WXL5tNBeQB6tW0xLDPURRA][df_smsdata][1]: SearchParseException[[df_smsdata][1]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"multi_match\":{\"query\":\"Robert Smith\",\"type\":\"cross_fields\",\"fields\":[\"vorname\",\"familienname\"]}}}]]]; nested: QueryParsingException[[df_smsdata] [multi_match] query does not support type cross_fields]; }{[WXL5tNBeQB6tW0xLDPURRA][df_smsdata][0]: SearchParseException[[df_smsdata][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"multi_match\":{\"query\":\"Robert Smith\",\"type\":\"cross_fields\",\"fields\":[\"vorname\",\"familienname\"]}}}]]]; nested: QueryParsingException[[df_smsdata] [multi_match] query does not support type cross_fields]; }]",
"status": 400
}
我可以看到查询不支持cross_fields
的解析异常。在创建索引时有什么必须设置的吗?
答案 0 :(得分:1)
在您的链接文档中,它说:
multi_match查询的类型
请注意 在1.1.0中添加。
http://www.elasticsearch.org/blog/elasticsearch-1-1-0-released/
中也提到过您需要下载更新版本。