Reputation: 599
My DSL query is below
GET index_name/_search
{
"query" : {
"query_string" : {
"query" : "*avi*",
"fields" : [
"data.name"
]
}}}
I need to add "query" : "*ojh*"
also.
Below query not working
GET index_name/_search
{
"query" : {
"query_string" : {
"query" : "*avi*",
"query" : "*ojh*",
"fields" : [
"data.name"
]
}}}
Upvotes: 0
Views: 412
Reputation: 217294
You need to leverage the bool/should
query and add two query_string
queries:
{
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "*avi*",
"fields": [
"data.name"
]
}
},
{
"query_string": {
"query": "*ojh*",
"fields": [
"data.name"
]
}
}
]
}
}
}
Just note, though, that doing infix searches like this can kill the performance of your cluster. See this thread on how to properly do "substring" searches.
Upvotes: 1