Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates search text field to keyword subfield for policies and managed indices #267

Merged
merged 3 commits into from
Apr 15, 2022

Conversation

dbbaughe
Copy link
Contributor

Issue #, if available:
opensearch-project/index-management-dashboards-plugin#117
opensearch-project/index-management-dashboards-plugin#119
opensearch-project/index-management-dashboards-plugin#112

Description of changes:
The mappings for the managed index and policy name/id fields were going through the standard analyzer which meant an index or policy with a name like "foo-bar-baz" would be broken up into tokens: ["foo", "bar", "baz"] and there would be no more hyphen. That combined with our use of the query string query which would also incorrectly use a hyphen as a negation (sometimes) and other unwanted behavior with wildcards being prepended/appended would cause searches on the UI to return empty results. e.g. searching "foo-*" would not return "foo-bar-baz".

So instead we'll query the keyword which should have stayed the same, added test cases to make sure hyphens and periods at least are working as we expect them to, and all other tests were passing so hoping no unknown regressions..

Tested on the UI with no changes and searches are working as expected now when the search bar includes hyphens or periods for datastreams.

CheckList:

  • Commits are signed per the DCO using --signoff

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.

@dbbaughe dbbaughe requested a review from a team February 16, 2022 22:10
…ying managed indices and policies

Signed-off-by: Drew Baugher <[email protected]>
"total_managed_indices" to 4
)
// These should match all non datastream managed indices
assertResponseMap(expected, getExplainMap(indexName = null, queryParams = "queryString=$testIndexName*"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: hardening test a little bit, a case with two space separated tokens so we are covering AND condition we are enforcing always

thalurur
thalurur previously approved these changes Feb 17, 2022
@dbbaughe
Copy link
Contributor Author

Discussed with Ravi offline, if someone was taking advantage of the negation part of the query string, such as return me all managed indices that do not have the token -foobar in the name, then this would break that as the new behavior would be return me all managed indices that do not have an index name of foobar (as it's exact now). That being said... I don't think this is a behavior we ever went out to support, so it's more akin to a bug becoming a feature if someone did use it this way. The original intent was always just a simple query string that lets you search up index names and use a glob * pattern to match any number of characters. We plan to introduce this currently in the 2.0 version.

@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2022

Codecov Report

Merging #267 (aa9bc85) into main (6259f9a) will increase coverage by 0.18%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #267      +/-   ##
============================================
+ Coverage     76.60%   76.79%   +0.18%     
+ Complexity     2050     2049       -1     
============================================
  Files           253      253              
  Lines         11642    11642              
  Branches       1808     1808              
============================================
+ Hits           8918     8940      +22     
+ Misses         1753     1734      -19     
+ Partials        971      968       -3     
Impacted Files Coverage Δ
...ment/indexstatemanagement/util/RestHandlerUtils.kt 100.00% <ø> (ø)
...transport/action/explain/TransportExplainAction.kt 67.31% <100.00%> (ø)
...ort/action/getpolicy/TransportGetPoliciesAction.kt 87.23% <100.00%> (ø)
...nt/indexstatemanagement/model/destination/Slack.kt 43.47% <0.00%> (-17.40%) ⬇️
...nt/indexstatemanagement/ManagedIndexCoordinator.kt 75.22% <0.00%> (-0.31%) ⬇️
...earch/indexmanagement/transform/model/Transform.kt 85.89% <0.00%> (+0.42%) ⬆️
...nt/rollup/action/stop/TransportStopRollupAction.kt 77.64% <0.00%> (+1.17%) ⬆️
...ndexstatemanagement/IndexStateManagementHistory.kt 80.00% <0.00%> (+1.37%) ⬆️
.../rollup/action/start/TransportStartRollupAction.kt 75.29% <0.00%> (+3.52%) ⬆️
...statemanagement/model/destination/CustomWebhook.kt 95.71% <0.00%> (+28.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87f13da...aa9bc85. Read the comment docs.

@thalurur thalurur merged commit 2874937 into opensearch-project:main Apr 15, 2022
wuychn pushed a commit to ochprince/index-management that referenced this pull request Mar 16, 2023
…d indices (opensearch-project#267)

* Use the keyword subfield instead of the tokenized text field for querying managed indices and policies

Signed-off-by: Drew Baugher <[email protected]>

* Changing the job scheduler distribution path

Signed-off-by: Ravi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants