不为失败找理由,要为成功找方法。

7.14.0的版本,怎么去结果集去重

Elasticsearch | 作者 zh7314 | 发布于2021年09月13日 | 阅读数:164

GET /his_index/_search
{
"query": {
"match": {
"project_name": "血清白蛋白测定(化学法)"
}
},
"collapse": {
"field": "project_name"
}
}
报错
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "collapse is not supported for the field [project_name] of the type [text]"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "his_index",
"node" : "fSOy_2PUTGar7-7gO6YREg",
"reason" : {
"type" : "illegal_argument_exception",
"reason" : "collapse is not supported for the field [project_name] of the type [text]"
}
}
],
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "collapse is not supported for the field [project_name] of the type [text]",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "collapse is not supported for the field [project_name] of the type [text]"
}
}
},
"status" : 400
}
text分词的字段不支持 collapse吗?还是我写错了?还是7.14.0版本不支持collapse
已邀请:

Charele

赞同来自:

跟es版本没有关系。
text是分词的,collapse不了。
换成project_name.keyword

要回复问题请先登录注册