-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Returning ignored fields in the simulate ingest API #117214
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
Returning ignored fields in the simulate ingest API #117214
Conversation
Hi @masseyke, I've created a changelog YAML for you. |
Pinging @elastic/es-data-management (Team:Data Management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks Keith!
@@ -168,11 +177,12 @@ protected void doInternalExecute( | |||
/** | |||
* This creates a temporary index with the mappings of the index in the request, and then attempts to index the source from the request | |||
* into it. If there is a mapping exception, that exception is returned. On success the returned exception is null. | |||
* @parem componentTemplateSubstitutions The component template definitions to use in place of existing ones for validation | |||
* @param componentTemplateSubstitutions The component template definitions to use in place of existing ones for validation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, nice catch :)
@@ -360,6 +372,23 @@ private void validateUpdatedMappings( | |||
0 | |||
); | |||
}); | |||
final Collection<String> ignoredFields; | |||
if (result == null) { | |||
ignoredFields = List.of(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably just do return List.of();
here and avoid having to create the ignoredFields
local field? It's not a big deal either way though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of prefer having a single return statement rather than 3 -- it makes debugging easier for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay either way :)
ignoredFields = List.of(); | ||
} else { | ||
List<LuceneDocument> luceneDocuments = result.parsedDoc().docs(); | ||
if (luceneDocuments != null && luceneDocuments.size() == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an assert luceneDocuments().size() == 1
somewhere here to ensure that we fail if in the future a single index request results in more than one doc? (We'd silently ignored the response if we didn't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
💚 Backport successful
|
As described in #116497, A new
ignored_fields
array is returned if ingest would ignore any fields in the input. For example: