Creating Elasticsearch Java models for unit testing

(Using v6.5.2 of both cluster and Java clients)

I am attempting to implement an application that uses the Elasticsearch aggregations API to provide a variety of metrics to a client. I want to be able to unit test the lower-level code in my application that converts Elasticsearch SearchResponse and Aggregations objects into my applications' internal models. However, creating these models is prohibitively difficult and mocking them is cumbersome, if not impossible.

  1. Is there a simple means to create a model like Aggregations (using fromXContent, perhaps?) that I am missing?
  2. Is there a strategy for mocking the RestHighLevelClient such that I can then validate our application's business logic performed on the Elasticsearch models?

Thanks for any help

Best,
Alex

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.