wuyunfeng commented on a change in pull request #1529: [CALCITE-3442] In
ElasticSearch adapter, set `stored_fields = _none_` to prohibit FetchPhase get
involved
URL: https://github.com/apache/calcite/pull/1529#discussion_r339446188
##########
File path:
elasticsearch/src/main/java/org/apache/calcite/adapter/elasticsearch/ElasticsearchTable.java
##########
@@ -186,6 +186,11 @@ String scriptedFieldPrefix() {
query.put("_source", false);
query.put("size", 0);
query.remove("script_fields");
+ // set _source = false and size = 0, `FetchPhase` would still be executed
+ // to fetch the metadata fields and visit the Lucene stored_fields,
+ // which would lead to performance declined dramatically.
+ // `stored_fields = _none` can prohibit such behavior entirely
+ query.put("stored_fields", "_none_");
Review comment:
hi, @danny0405 . Thanks for review. I have worked on Doris On
Elasticsearch (https://github.com/apache/incubator-doris/pull/2047). I found
this problem few months ago, If the query sent to Elasticsearch without
`stored_fields : _none_` the fetch phase must be executed in order to get some
meta data fields
I submit a PR for es can implicitly promote this behavior:
https://github.com/elastic/elasticsearch/pull/41155
but they told me add `stored_fields : _none_` to the query can reach this
goal.
Elasticsearch X-Pack SQL, they also add `stored_fields : _none_` to the
query for Aggregation Transform
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services