i'm using spring data elasticsearch and i indexing this document in elastic
{
"country":{
"name":"jordan",
"cities" : [
{
"id":1,
"name":"amman"
},
{
"id":2,
"name":"jarash"
},
{
"id":3,
"name":"aqaba"
},
{
"id":4,
"name":"salt"
},
{
"id":5,
"name":"karak"
}
]
}
}
so i need to write query to get the country with all cities their names start with 'a' character
so expected result should be :
{
"country":{
"name":"jordan",
"cities" : [
{
"id":1,
"name":"amman"
},
{
"id":3,
"name":"aqaba"
}
]
}
}
so how can i achieve that using spring data ?