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

Move model metadata retrieval out of mapper build method #111

Conversation

jmazanec15
Copy link
Member

Description

This change moves model metadata retrieval out of the model mapper build logic. The reason for this can be found in #110. From a user's perspective, the model_id they pass in during index creation will not be validated until they start ingesting documents.

As a side effect of this change, we can no longer write values such as KNNEngine and SpaceType to the Mapper's Lucene fieldType. These values are read elsewhere in the plugin, such as during indexing in the KNNDocValuesConsumer, as well as during querying. Therefore, that logic needed to be changed as well.

I tested the changes manually on my train API implementation and they work. I also added a single node test case that creates an index from a model. Currently, this fails due to an issue with writing the timestamp. I will submit another PR to fix this.

Issues Resolved

#110

Check List

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

@jmazanec15 jmazanec15 requested a review from vamshin October 3, 2021 21:41

public KNNVectorFieldType(String name, Map<String, String> meta, int dimension) {
super(name, false, false, true, TextSearchInfo.NONE, meta);
this.dimension = dimension;
this.modelId = null; // By default, this is null. It will only be set for a mapping with a modelId set.
Copy link
Member

Choose a reason for hiding this comment

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

This constructor should call other constructor with modelId as null

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, will update

@jmazanec15 jmazanec15 requested a review from VijayanB October 4, 2021 17:07
ModelMetadata modelMetadata = this.modelDao.getMetadata(modelId);

if (modelMetadata == null) {
throw new IllegalStateException("Model \"" + modelId + "\" does not exist. A new index will need to " +
Copy link
Member

Choose a reason for hiding this comment

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

Can you check error message?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

Signed-off-by: John Mazanec <[email protected]>
Copy link
Member

@vamshin vamshin left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@jmazanec15 jmazanec15 merged commit 6d7eb0a into opensearch-project:feature/faiss-support Oct 5, 2021
jmazanec15 added a commit to jmazanec15/k-NN-1 that referenced this pull request Oct 22, 2021
jmazanec15 added a commit that referenced this pull request Oct 22, 2021
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 7, 2022
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 7, 2022
martin-gaievski pushed a commit to martin-gaievski/k-NN that referenced this pull request Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants