The details object is a nested type.
I'm trying to do 2 types of searches. One is to get_by_propId and the other is to get objects from the array where liked is true
I have this query for the first type of search at least. It's returning the entire object though.
For the part 1 where you want to get only the nested documents that matches the id to be returned, all you have to do is to use inner_hits inside the nested query. This will add an additional key inner_hits in the response under which you'll get only those nested documents which matched the query.
For the second part i.e. to get only the nested documents where value of liked field is true you can create a similar query for the field liked and use inner_hits as in the above query.
Thank you. That's exactly what I wanted. I got it to work using inner_hits.
I do have a similar question question though. Is it possible to do something similar if I had a map of objects instead of a nested object? So suppose if my source looked like the following:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.