I've recently updated my org.elasticsearch.elasticsearch jar from v2.3.3 to v5.4.2.
My code is using many of the AggregationBuilders and QueryBuilders functions and I've noticed that the generated JSON is now including many low-level fields with default values. Is there a way to turn these off in order to keep the generated JSON simpler, or is there a performance benefit to actually request with these parameters?
For example, when I use the AggregationBuilders.terms(...) method, the generated JSON includes the following fields with their default variables:
min_doc_count:1, shard_min_doc_count:0, show_term_doc_count_error:false, order:[[_count:desc], [_term:asc]].
unfortunately there is no way to turn this off currently. The reason for sending all parameters of an aggregation or query builder is that it makes the xContent rendering logic much easier by not having to check all the time if some value are set to the default or not. We simply transfer the whole representation of what's in the object, regardless if set by the user or default.
OK, that makes sense. Is there a specific reason that the defaults exist in the object in the first place rather than just letting ES apply defaults behind the scenes?
QueryBuilders, AggregationBuilders and their kin are slightly misnamed at this point, because they are no real "builders" in a strict sense anymore (at least how I see it). Historically I think they were ment to be only used to make Json/xContent creation easy, now they are used as full representation of the query/agg until it reaches the shard and is rewritten to e.g. a Lucene query. That why the defaults are represented in the objects themselves.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.