有没有办法按query_string编写此查询?
(字段_one:“字一”或“字二”或“字三”)AND(字段一:“字_四”或“字_五”或“字_六”)AND(字段_二:“字_七”或“字_八”或“字_九”)
就像这样,但是有三个字段和三个查询?
"query": {
"bool": {
"must": [
{
"query_string": {
"fields": [
"my_search_field"
],
"query": "my_search_query"
}
}
]
}
}
我试着用filter写它:
"filter": [
{
"bool": {
"filter": [
{
"bool": {
"should": should_phrases_a, #words by field_one
"minimum_should_match": 1
}
},
{
"bool": {
"should": should_phrases_b, #words by field_one
"minimum_should_match": 1
}
},
{
"bool": {
"should": should_phrases_c, #words by field_two
"minimum_should_match": 1
}
}
]
}
}
]
其中_phase_a/B/c应类似于以下内容的列表:
{"bool": {"should": [{
"match_phrase": {
"field_one": "word_one"
}
}
],
"minimum_should_match": 1
}
}
但它对我不起作用,只适用于one_field交集(没有与should_phrases_c的部分):
(字段_one:“字一”或“字二”或“字三”)AND(字段一:“字_四”或“字_五”或“字_六”)
1条答案
按热度按时间kd3sttzy1#
您可以在查询中指定字段
查询