It's my first post so I'd like to say Hi,
In my project I have a nested multi-level structure and I'm building a kind of D&D query builder where conditions from any level may be grouped together and any condition may be usued multiple times.
The easiest way form me to build complex queries would be if I could repeat nested queries with the same path but this seems to not work as I expected. Here's an example:
{
"query": {
"bool": {
"must": [
{
"nested": {
"path": "g",
"query": {
"term" : {
"g.t1" : {
"query" : "term1"
}
}
}
}
},
{
"nested": {
"path": "g",
"query": {
"term" : {
"g.t2" : {
"query" : "term2"
}
}
}
}
}
]
}
}
}
This query produces g.t1 = "term1" || g.t2 = "term2", but i would expect it to produce
g.t1 = "term1" && g.t2 = "term2".
I know I can combine this case under one nested query but this is just a simple example. In my real application, conditions are much more complex and trying to combine them under single nested query may be hard. Is there a way to achieve an AND condition with the structure I presented? If no, could anyone please give me a hint like to build such a complex queries?
Thanks in advance