Open expani opened 20 hours ago
The above checks fixed the issue. But, there are other issues like validation of field name present in query against metrics and dimensions (CompositeDataCubeFieldType
) to ensure it can make use of star tree index.
Will take a deeper look into it later.
There is no error in the query when Star Tree feature flag is disabled. It just returns empty hits.
{"took":4,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]},"aggregations":{"average_latency":{"value":null},"sum_request_size":{"value":0.0}}}
So, we were never validating fields used in aggregation against the actual fields of index. Most of the existing aggregation queries without star tree have the same issue.
I was able to manage the same response for metric aggregation queries with these changes.
Describe the bug
When running Metric aggregation queries over indices that have star tree enabled, using invalid field names in the query leads to a 500 Internal Server Error.
Related component
Search
Reproduction Steps
Checkout the main branch of OpenSearch.
We need to enable the star tree feature flag Add this line in OpenSearchNode#createConfiguration() which is the default config used with gradlew run.
Build the checkout and run the server
./gradlew run
Enable the Cluster setting
indices.composite_index.star_tree.enabled
for indexingCreate Index
Run a search query containing an invalid field name.
request_size
in this case.A 500 Internal Server Error is thrown with the below exception seen in logs.
Expected behavior
400 Bad Request should be returned with appropriate error message.