You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] sort on a text field with dedup or a computed key returns 400 "Text fields are not optimised for sorting" #6020
What is the bug? sort t on a text field works on its own, but sort t | dedup s and eval e = abs(n) | sort t, e push the text sort down to OpenSearch, and the shard rejects it.
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d '{"query":"source=hdemo | sort t | dedup s"}'| jq -c '{status, error: .error.details[0:90]}'# {"status":400,"error":"java.sql.SQLException: exception while executing query: Failed to fetch data from the inde"}
A text sort with a function-computed key:
curl -s -X POST localhost:9200/_plugins/_ppl -H 'Content-Type: application/json' \
-d '{"query":"source=hdemo | eval e = abs(n) | sort t, e"}'| jq -c '{status, error: .error.details[0:90]}'# {"status":400,"error":"java.sql.SQLException: exception while executing query: Failed to fetch data from the inde"}
Both queries return rows with plugins.calcite.pushdown.enabled=false, and sort t | head 1 | fields t returns [["hello world"]] with pushdown on.
What is the expected behavior?
The same rows as with pushdown off. Either the sort stays in memory, as it does for sort t alone, or it uses a keyword sub-field when one exists.
The inner shard error is Text fields are not optimised for operations that require per-document field data like aggregations and sorting....
Step 2 goes through dedup pushdown (top_hits/composite carrying the sort). Step 3 happens only with a function key (abs(n), floor(d), but not n + 1), which pushes both keys as one script/field sort. Splitting the sort (sort e | sort t) avoids it (not verified which rule pushes the text key).
Activity