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 ?

2
  • I am trying to understand this since at least one week. Commented Oct 10, 2019 at 14:35
  • i hope someone has a solution for my question Commented Oct 11, 2019 at 11:16

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.