使用弹性搜索进行搜索会在控制台上显示以下错误
{ “_碎片”:{ “总”:5, “成功”:0, “失败”:5, “失败”:[{ “索引”: “测试”, “碎片”:4 “原因” :“BroadcastShardOperationFailedException [[test] [4]];嵌套:ElasticSearchException [未能执行建议];嵌套:ElasticSearchIllegalArgumentException [[suggest]不支持[size]];”},{“index”:“test”,“ shard“:3,”reason“:”BroadcastShardOperationFailedException [[test] [3]];嵌套:ElasticSearchException [执行失败建议];嵌套:ElasticSearchIllegalArgumentException [[suggest]不支持[size]];“},{” index“:”test“,”shard“:2,”reason“:”BroadcastShardOperationFailedException [[test] [2]];嵌套:ElasticSearchException [未能执行建议];嵌套:ElasticSearchIllegalArgumentException [[suggest]不支持[size] ]];“},{”index“:”test“,”shard“:0,”reason“:”BroadcastShardOperationFailedException [[test] [0]];嵌套:ElasticSearchException [无法执行建议];嵌套:ElasticSearchIllegalArgumentException [ [建议]不支持[size]];“},{”index“: “test”,“shard”:1,“reason”:“BroadcastShardOperationFailedException [[test] [1]];嵌套:ElasticSearchException [未能执行建议];嵌套:ElasticSearchIllegalArgumentException [[suggest]不支持[size]]; “}]}}
无法理解可能的原因我正在使用轮胎/ karmi ES版本为0.9.9
这是我的映射代码
{
"test" : {
"document" : {
"properties" : {
"artikelnummer" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs"
},
"bestelltext" : {
"type" : "multi_field",
"fields" : {
"bestelltext" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"bezeichnung" : {
"type" : "multi_field",
"fields" : {
"bezeichnung" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
},
"suggest" : {
"type" : "string",
"analyzer" : "suggest_analyzer",
"include_in_all" : false
}
}
},
"bezeichnung_zusatz" : {
"type" : "multi_field",
"fields" : {
"bezeichnung_zusatz" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"dimension" : {
"type" : "string",
"include_in_all" : false
},
"eannummer" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs"
},
"gewicht" : {
"type" : "float",
"include_in_all" : false
},
"gruppe" : {
"type" : "multi_field",
"fields" : {
"gruppe" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"gruppe_nummer" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs",
"include_in_all" : false
},
"gruppe_zusatz" : {
"type" : "multi_field",
"fields" : {
"gruppe_zusatz" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"hersteller" : {
"type" : "multi_field",
"fields" : {
"hersteller" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
},
"unchanged" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs",
"include_in_all" : false
}
}
},
"hersteller_artikelnummer" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs"
},
"hersteller_nummer" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs",
"include_in_all" : false
},
"hierarchie" : {
"type" : "multi_field",
"fields" : {
"hierarchie" : {
"type" : "string",
"index_analyzer" : "hierarchie_index_analyzer",
"search_analyzer" : "keyword",
"include_in_all" : false
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"infotext" : {
"type" : "multi_field",
"fields" : {
"infotext" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"langtext" : {
"type" : "multi_field",
"fields" : {
"langtext" : {
"type" : "string"
},
"ngram" : {
"type" : "string",
"index_analyzer" : "ngram_index_analyzer",
"search_analyzer" : "ngram_search_analyzer",
"include_in_all" : false
}
}
},
"listenpreis_brutto" : {
"type" : "float",
"include_in_all" : false
},
"listenpreis_netto" : {
"type" : "float",
"include_in_all" : false
},
"matchcode" : {
"type" : "string",
"index" : "not_analyzed",
"omit_norms" : true,
"index_options" : "docs"
},
"mengeneinheit" : {
"type" : "string",
"include_in_all" : false
}
}
}
} }
答案 0 :(得分:0)
这与您的映射无关。这与您正在进行的搜索呼叫有关。在某个地方,您可以在调用搜索API时使用“尺寸”关键字。
看起来您正在使用建议者端点,并且您在“suggest”关键字下直接使用“size”关键字。这是我的PHP代码示例(我知道它不是在Ruby中,但它仍然说明了这一点)。
$searchParams['body']['suggest'] = array(
'text' => strtolower(trim(urldecode($query))),
'simple_phrase' => array(
'phrase' => array(
'field' => "name",
'size' => 4,
'real_word_error_likelihood' => 0.95,
'confidence' => 1.0,
'gram_size' => 1,
'direct_generator' => array(
array(
"field" => "name",
"suggest_mode" => "always",
"min_word_len" => 1
),
array(
"field" => "name_reverse",
"suggest_mode" => "always",
"min_word_len" => 1,
"pre_filter" => "reverse",
"post_filter" => "reverse"
)
)
)
)
);
您可以看到我在“建议者”一词下使用“size”关键字,而不是直接在建议者下面。