I have a nested field in my elasticsearch. Imagine some data like this is stored on this field:
{
"id" : 1,
"students":[
{"name": "John", "age": 20},{"name": "Alexander", "age":25},{"name": "Elizabeth", "age": 15}
]
},
"id" : 2,
"students":[
{"name": "John", "age": 23},{"name": "Thomas", "age":30}
]
}
How can I query to get those documents which have student "John" and the his "age" is more than 21. If the query works well, the first document will not re retrieved as answer because "John" is 20 years old and we are looking for a "john" who is at least 21 years old. So, the second document must be retrieved. Thanks for your help.