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

Avoid using dynamic templates for semantic text fields #108771

Conversation

carlosdelest
Copy link
Member

@carlosdelest carlosdelest commented May 17, 2024

Avoids semantic_text fields to be used in dynamic templates.

We need the semantic_text fields to be already in the mapping so we can perform inference, so we're disallowing it based on the work done in #107491 .

I've refactored some of the existing tests so we can ensure that the field mapper does comply with the requirements, and created some utilities for dealing with inference services.

@carlosdelest carlosdelest added :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team >non-issue labels May 17, 2024
@carlosdelest carlosdelest changed the title Carlosdelest/semantic text avoid dynamic templates Avoid using dynamic templates for semantic text fields May 17, 2024
@carlosdelest carlosdelest marked this pull request as ready for review May 17, 2024 15:30
@carlosdelest carlosdelest requested a review from a team as a code owner May 17, 2024 15:30
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored this class to make it a base test case

@@ -143,66 +137,4 @@ public void testBulkOperations() throws Exception {
}
}

private void storeSparseModel() throws Exception {
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored out some utility classes to be reused

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

LGTM! Left one comment about potentially improving test ergonomics.


protected abstract String getTypeName();

protected abstract String getMapping();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: The format of the string returned by this method is quite specific and could trip people up in the future. Would a Map<String, Object> return type here work? We could then convert it to JSON in the abstract class. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've been thinking about this too - I'd like to have more use cases before reaching a decision about the format. I don't see a particular advantage on using something similar to MapperTestCase.minimalMapping(), at least for now.

@carlosdelest carlosdelest merged commit 0c35e13 into elastic:main May 20, 2024
15 checks passed
jedrazb pushed a commit to jedrazb/elasticsearch that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants