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?
genresfield is ofnestedtype, it's possible to do it with a nestedinner_hits. This answer might help: stackoverflow.com/questions/32773542/…