I need to dynamically make elastic search query based on AND, OR query.
User inputs a string similar to SQL format:
((("query1 query2" OR query3) OR query4) AND (query5 OR query6)) AND query7
I parse it to array:
[
'AND' => [
[
'AND' => [
[
'OR' => [
[
'OR' => [
'" query1 query 2"',
'query3'
]
],
'query4'
]
],
[
'OR' => [
'query5',
'query6'
]
]
]
],
'query7'
]
]
And based on this array I need to make a search for one field.
Something like:
{"bool":{"must":[{"match":{"title":"research"}},{"match":{"title":"lecturer"}}]}}
But I'm stuck with nested conditions. Please advise.