ES7 - HighLevelClient: QueryBuilder serialization / Licensing / performance single node


i moved our java application from 1.7 to 7.14 (kinda lot of work... much changed, steps were 1.3 -> 1.7 -> 2.0 -> 2.4 -> 5.6 -> 6.18 -> 7.14) and its now nearly working as expected. However, somewhere during the 2.x time it seems hat QueryBuilders.queryXXXX has lost the good old way of .toBytes() and .fromBytes() functions, so I dont really know now how to searlize a queryBuilder.


Currently Im doing:

private final String queryAsString;

public ElasticSearchQueryDataProvider(QueryBuilder builder) {
SearchSourceBuilder ssb = new SearchSourceBuilder().query(builder);
        JSONObject o = new JSONObject(ssb.toString());
        queryAsString =  o.getJSONObject("query").toString();

private SearchSourceBuilder initBuilder() {
        SearchSourceBuilder ssb = new SearchSourceBuilder();

So I basically extract the query JSON Object, grab the query part and then feed it again to the new SearchSourceBuilder. Is this the best way to do this? Especially most performant one?

The class itself needs to be serializable, thus I cant save the QueryBuilder itself. We do this as the query is part of a DataProvider that has a longer lifespan and can be written do disk etc. by wicket framework.

Licensing Question:

Since the new license isnt apache 2 anymore I came to the conclusion:

  • we may use the elasticsearch-rest-high-level-client in our application as its still apache 2
  • we may use the ELK package by ourself and installed by ourself
  • since the ELK is not part of our application itself there is no problem from license change

Am I assuming right?


How can we get maximum performance from ES 7 in a single node configuration?
We use ES only as temporary storage, so indexes get deleted and recreated every 30 mins while switching over to a index after its created and has data while the old one gets removed (and alias points to new one)

In ES 1.x times we used the in-memory-store, but thats not available anymore....




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