gpt4 book ai didi

elasticsearch - 如何在Elasticsearch中使用数组字段精确查找短语?

转载 作者:行者123 更新时间:2023-12-03 01:59:27 25 4
gpt4 key购买 nike

我有字段singers映射的索引,例如:

"singers": {
"type": "string",
"index_name": "singer",
"analyzer": "unicode_analyzer"
}

示例数据如下:
"singers": [
"Đàm Vĩnh Hưng",
"Thanh Lam (NSƯT)"
]

现在,我想查找index是否具有准确的歌手姓名“ĐàmVĩnhHưng”,该怎么办?

目前,我尝试了:
{
"query": {
"terms": {
"singers": [
"Đàm Vĩnh Hưng"
]
}
}
}

但是结果是空的。

任何建议都将受到欢迎。感谢你们。

经过尝试,当我使用 match_phrase时,我解决了这个问题。我将保留给遇到相同问题的任何人。请关闭此。谢谢。

最佳答案

使用match_phrase

{
"query": {
"match_phrase": {
"singers": "Đàm Vĩnh Hưng"
}
}
}

关于elasticsearch - 如何在Elasticsearch中使用数组字段精确查找短语?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34035317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com