Search code examples
elasticsearchelasticsearch-jest

Parsing inner hits along with source


We are using Jest java client for interacting with E.S in our application.

We have a document structure like below :

{
  "productId":123,
  "reviews":[ // <============ NESTED
   {"id":1, "rating":3, "epoch":12345}
   {"id":2, "rating":4, "epoch":12346}
  ]
}

Product Class:

 class Product {
    int productId;
    List<Review> reviews; // Review class has id, rating and epoch
  }

We have to return the most recent review for each product. For that, we are using inner_hits query.

Help needed for: I tried my best but I didn't find any method with-in JEST client to parse inner_hits along with the source.


Solution

  • It is not yet implement in Jest.

    An issue has been opened two years ago, but it is still open today.

    It looks like Jest has been "dormant" to say the least...

    You should consider leveraging the official High-Level Java REST client instead as it provides support for inner_hits as you would expect.