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

create model/task index with correct mapping #284

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

ylwu-amzn
Copy link
Collaborator

@ylwu-amzn ylwu-amzn commented Apr 18, 2022

Signed-off-by: Yaliang Wu ylwu@amazon.com

Description

We found security test testReadOnlyUser_CanSearchModels failed. Debug locally and found ML model index mapping is wrong: filed algorithm was set as text type
So when search with this query, will return empty result.

POST /_plugins/_ml/models/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "algorithm": "KMEANS"
          }
        }
      ]
    }
  }
}

This PR fix this bug by setting mapping in create index request. Will backport this to 2.x and 2.0.

Bug introduced in this PR #257

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • 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.

Signed-off-by: Yaliang Wu <ylwu@amazon.com>
@ylwu-amzn ylwu-amzn added bug Something isn't working backport 1.x labels Apr 18, 2022
@ylwu-amzn ylwu-amzn requested review from a team, Zhangxunmt and jackiehanyang April 18, 2022 23:23
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2022

Codecov Report

Merging #284 (525ee41) into main (972228d) will decrease coverage by 0.18%.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #284      +/-   ##
============================================
- Coverage     92.16%   91.98%   -0.19%     
+ Complexity      360      359       -1     
============================================
  Files            51       51              
  Lines          1111     1111              
  Branches         51       51              
============================================
- Hits           1024     1022       -2     
- Misses           69       70       +1     
- Partials         18       19       +1     
Flag Coverage Δ
ml-commons 91.98% <100.00%> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...va/org/opensearch/ml/indices/MLIndicesHandler.java 75.75% <100.00%> (ø)
.../java/org/opensearch/ml/task/MLTaskDispatcher.java 96.22% <0.00%> (-3.78%) ⬇️

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 972228d...525ee41. Read the comment docs.

@ylwu-amzn ylwu-amzn merged commit 0bae134 into opensearch-project:main Apr 18, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.x 1.x
# Navigate to the new working tree
cd .worktrees/backport-1.x
# Create a new branch
git switch --create backport/backport-284-to-1.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0bae1348c80463ea40f193d0db8f8ccfd2467dd0
# Push it to GitHub
git push --set-upstream origin backport/backport-284-to-1.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.x

Then, create a pull request where the base branch is 1.x and the compare/head branch is backport/backport-284-to-1.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 1.3 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.3 1.3
# Navigate to the new working tree
cd .worktrees/backport-1.3
# Create a new branch
git switch --create backport/backport-284-to-1.3
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 0bae1348c80463ea40f193d0db8f8ccfd2467dd0
# Push it to GitHub
git push --set-upstream origin backport/backport-284-to-1.3
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.3

Then, create a pull request where the base branch is 1.3 and the compare/head branch is backport/backport-284-to-1.3.

opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 18, 2022
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 0bae134)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 18, 2022
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 0bae134)
ylwu-amzn added a commit that referenced this pull request Apr 18, 2022
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 0bae134)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
ylwu-amzn added a commit that referenced this pull request Apr 18, 2022
Signed-off-by: Yaliang Wu <ylwu@amazon.com>
(cherry picked from commit 0bae134)

Co-authored-by: Yaliang Wu <ylwu@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x backport 2.0 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants