OpenSearch
OpenSearch copied to clipboard
[bug fix] validate lower bound for top n size
Description
Currently the top n size can be set to a negative number. We want to limit top size between 1 and QueryInsightsSettings.MAX_N_SIZE
.
curl -X PUT 'localhost:9200/_cluster/settings' -H 'Content-Type: application/json' -d'
{
"persistent" : {
"search.insights.top_queries.latency.top_n_size" : -1
}
}'
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"illegal value can't update [search.insights.top_queries.latency.top_n_size] from [3] to [-1]"}],"type":"illegal_argument_exception","reason":"illegal value can't update [search.insights.top_queries.latency.top_n_size] from [3] to [-1]","caused_by":{"type":"illegal_argument_exception","reason":"Top N size setting for [latency] should be between 1 and 100, was (-1)"}},"status":400}
Check List
- [x] Functionality includes testing.
- [ ] API changes companion pull request created, if applicable.
- [ ] Public documentation issue/PR created, if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.