1

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 ?

1 Answers1

0

I think Spring Data Elastic Search with Nested Fields and mapping has the answer to our problems.

BioShock
  • 763
  • 2
  • 13
  • 33