gpt4 book ai didi

带有过滤器的 Elasticsearch simple_query_string

转载 作者:行者123 更新时间:2023-12-02 22:46:16 25 4
gpt4 key购买 nike

我有以下查询查询 (simple_query_string) 并且确实提出了建议,但在执行任何这些操作之前,我想使用一个术语来过滤数据。

{
"query": {
"simple_query_string": {
"fields": ["merchant.basic"],
"query": "(sterbuck|sterbuck*)",
"default_operator": "and"
}
},
"suggest": {
"text": "sterbuck",
"phraseSuggestion": {
"phrase": {
"field": "merchant.basic",
"direct_generator": [{
"field": "merchant.basic",
"suggest_mode": "popular",
"min_word_length": 3,
"prefix_length": 2
}]
}
}
},
"size": 4,
"_source": ["merchant"]
}

提前谢谢你。

最佳答案

{
"query":{
"bool":{
"must":{
"simple_query_string": {
"fields": ["merchant.basic"],
"query": "(star|star*)",
"default_operator": "and"
}
},
"filter":{
"term":{
"name":"michael"
}
}
}
},
"suggest": {
"text": "sterbuck",
"phraseSuggestion": {
"phrase": {
"field": "merchant.basic",
"direct_generator": [{
"field": "merchant.basic",
"suggest_mode": "popular",
"min_word_length": 3,
"prefix_length": 2
}]
}
}
},
"size": 4,
"_source": ["merchant"]
}

关于带有过滤器的 Elasticsearch simple_query_string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43709622/

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