1

I am working with Java Api of elastic search.

Lets say I fetch below mentioned json data from elastic search.

  {
     "id":"123",
      "genres":[{"key":"EN","value":"action"},{"key":"FR","value":"action"}]
    },
    {
      "id":"234",
      "genres":[{"key":"EN","value":"action"},{"key":"FR","value":"drama"}]
    }

I want to slice/filter data on the basis of the value of key property. For example on passing key as EN I want below mentioned data. I have tried nested query but it did not work.

Expected output:

 {
     "id":"123",
      "genres":[{"key":"EN","value":"action"}]
    },
    {
      "id":"234",
      "genres":[{"key":"EN","value":"action"}]
    }

Can this be achieved in elastic search?

4
  • 1
    Yes, if your genres field is of nested type, it's possible to do it with a nested inner_hits. This answer might help: stackoverflow.com/questions/32773542/… Commented Feb 7, 2017 at 16:45
  • Let me try this concept. Commented Feb 7, 2017 at 16:52
  • Unfortunately our code base is 1.4 and this concept is not present in that. Commented Feb 7, 2017 at 17:15
  • You know what to do: upgrade :-) 1.4 is not supported anymore Commented Feb 7, 2017 at 17:15

0

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.