ml-commons icon indicating copy to clipboard operation
ml-commons copied to clipboard

[Enhancement] Auto Upgrade Mappings for system indices in ML-Commons

Open Zhangxunmt opened this issue 1 year ago • 1 comments

What is the bug? When we add a field to the system index’s mapping (e.g. ml-model, ml-connector, etc), we should update the mapping proactively in the backend if the mapping changed before indexing. Currently, indexing a document which contains new fields will cause dynamic mapping, resulting in a text+keyword field and some Term/Query Search may not work properly anymore which is not expected. We should set dynamic to false for them to resolve this issue.

This problem occurs after the Memory index mapping is updated in the refactoring and the "memory_id" field is set to "text" through dynamic mapping. So the term search query doesn't return correct results based on the "memory_id".

Also, in this issue https://github.com/opensearch-project/ml-commons/issues/1860, updating the mapping for ml-models triggered some issues once the .plugins-ml-model is manually deleted in some edge cases.

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the expected behavior? A clear and concise description of what you expected to happen.

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context? Add any other context about the problem.

Zhangxunmt avatar Jan 29 '24 22:01 Zhangxunmt

This problem occurs after the Memory index mapping is updated in the refactoring and the "memory_id" field is set to "text" through dynamic mapping. So the term search query doesn't return correct results based on the "memory_id".

@Zhangxunmt why this will happen? looks like a bug

ylwu-amzn avatar Feb 02 '24 18:02 ylwu-amzn