opensearch-project / OpenSearch-Dashboards

📊 Open source visualization dashboards for OpenSearch.
https://opensearch.org/docs/latest/dashboards/index/
Apache License 2.0
1.69k stars 894 forks source link

Add more "Query string options" to Advanced Settings validator #3061

Open shamil opened 1 year ago

shamil commented 1 year ago

Describe the bug

The bug is described in details here https://github.com/elastic/kibana/issues/77062

To Reproduce Steps to reproduce the behavior:

  1. Go to app/management/opensearch-dashboards/settings
  2. Adjust query:queryString:options to include other setting beyond default { "analyze_wildcard": true }, like {"analyze_wildcard": true, "allow_leading_wildcard": false}
  3. Press Save Changes
  4. See error [validation [query:queryString:options].allow_leading_wildcard]: definition for this key is missing

Expected behavior Dashboards should accept the change

OpenSearch Version 2.4.0

Dashboards Version 2.4.0

Additional context

I can create a PR to add those fields, seems simple enough, but I'm not sure wether it will be accepted, since the required changes will need to be same as in newer versions of Kibana, after the license change.

joshuarrrr commented 1 year ago

@shamil Can you please re-summarize the details of the bug here rather than just providing a link? OpenSearch Dashboards maintainers and developers avoid reviewing or opening links to arbitrary kibana issues.

That said, I can reproduce based on the steps provided. Is the bug here that none of the other query string options work, or that definitions are missing for some of them in particular, such as allow_leading_wildcard? Also, do you know of a link to Lucene documentation that specifies valid options?

shamil commented 1 year ago

Hey @joshuarrrr I actually summarized it in the issue description. To add more, there is a schema validation here: https://github.com/opensearch-project/OpenSearch-Dashboards/blob/bb94a9d6fb795a6e11d4739f428430f5fab18461/src/plugins/data/server/ui_settings.ts#L117-L119

Basically only analyze_wildcard query option is allowed, in practice there are much more options available, like default_field, allow_leading_wildcard, analyzer, fields, all the fuzziness options and others. I think https://opensearch.org/docs/latest/opensearch/query-dsl/full-text/#query-string page kinda mentions those...

superawesome commented 1 year ago

I can confirm this also affects AWS Elasticsearch 7.10.2, and does not affect AWS ES 7.4. This might narrow down the search space for when it was introduced... although given that the upstream bug is fixed, maybe it doesn't matter.

xavier-isecurity commented 1 year ago

I can confirm it affects Opensearch 1.3.1

joshuarrrr commented 1 year ago

Thanks for bumping this thread. It looks like what we want to do is add the other supported querystring options to the validation logic in advanced settings: https://opensearch.org/docs/latest/query-dsl/full-text/#advanced-filter-options. I've updated the title accordingly.

@shamil - We'd happily accept a pull request, but the fix or solution should be original work, not based on any previous solutions with restricted licenses - see https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md#developer-certificate-of-origin for the requirements of the developer certificate of origin.