我想使用通配符在2个不同的列中搜索2个值,但使用2个值不能按预期运行,但可以在单个query_string上正常运行
这适用于单列
{
"query": {
"query_string" : {
"default_field" : "Phone",
"query" : "*568072*"
}
}
}
我尝试将其扩展为与2个具有2个不同值的列一起使用。
{
"query":
{
"bool":
{
"should": [
{
"query_string":
{
"query": "*Chicago*",
"fields": ["Sources"]
},
"query_string":
{
"query": "*493*",
"fields": ["Phone"]
}
}
]
}
}
}
我在哪里错了?
答案 0 :(得分:0)
You have a mistake in your query. You have one big object inside should
array, that has two same keys that does not make sense. Instead it should be array of objects like this:
{
"query": {
"bool": {
"should": [
{ "query_string": { "query": "*Chicago*", "fields": ["Sources"] } },
{ "query_string": { "query": "*493*", "fields": ["Phone"] } }
]
}
}
}