Combine exists query

Hey,
I want to look for documents who has field x OR field y.
I can't use bool:should because i'm using a bool:filter in the same query..

my current query:

GET /testing/_search?size=200
{
"query": {
"bool": {
"filter":[
{"regexp": {
"look_for_regex.keyword": "some_regex" }},
{"exists":{"field":"x"}}
]
}
}
}

the current query only looks for field x, how should i filter the documents who has field x or y?

Hi,

You can have bool queries into another bool must or should, etc...
So you can have a big bool with 2 should, with minumum should match = 1.
1rst bool will contains your current bool query, the 2d should will contain the exist on the y field.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.