-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Source includes triggers MapperParsingException/IllegalStateException if field is in an array #92480
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
Comments
For now the only work-around I found is to include a field that you expect to always be written int the nested documents, |
I don't think this relates to nested fields, it's to do with the
Definitely a bug tho. The stack trace is as follows:
|
Pinging @elastic/es-distributed (Team:Distributed) |
Hello @DaveCTurner! Thank you for looking into this. |
I think this is a bug in the XContent framework, possibly even Jackson, so I'm handing this over to core/infra. The following test shows the low-level problem: diff --git a/libs/x-content/src/test/java/org/elasticsearch/xcontent/support/filtering/AbstractXContentFilteringTestCase.java b/libs/x-content/src/test/java/org/elasticsearch/xcontent/support/filtering/AbstractXContentFilteringTestCase.java
index 0cc95f54693..445890c25bf 100644
--- a/libs/x-content/src/test/java/org/elasticsearch/xcontent/support/filtering/AbstractXContentFilteringTestCase.java
+++ b/libs/x-content/src/test/java/org/elasticsearch/xcontent/support/filtering/AbstractXContentFilteringTestCase.java
@@ -305,6 +305,24 @@ public abstract class AbstractXContentFilteringTestCase extends AbstractFilterin
);
}
+ public void testArrayWithEmptyObjectInInclude() throws IOException {
+ testFilter(
+ builder -> builder.startObject().startArray("foo").startObject().field("bar", "baz").endObject().endArray().endObject(),
+ builder -> builder.startObject()
+ .startArray("foo")
+ .startObject()
+ .field("bar", "baz")
+ .endObject()
+ .startObject()
+ .endObject()
+ .endArray()
+ .endObject(),
+ singleton("foo.bar"),
+ emptySet(),
+ true
+ );
+ }
+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/pull/80160")
public void testDotsAndDoubleWildcardInExcludedFieldName() throws IOException {
testFilter( One possible workaround is to include the whole array rather than just a specific field. Or even just stop using source includes and preserve the whole source. |
Pinging @elastic/es-core-infra (Team:Core/Infra) |
This looks like a bug in Jackson, @pgomulka & I are working on a fix. |
together with @tvernum we raised an issue and PR in jackson repo FasterXML/jackson-core#882 and FasterXML/jackson-core#883 |
Thank you so much for all your efforts. Unfortunately, not using the _source and the includes would impact more disk usage, and other provided workaround would require a high effort for users, which can not be ideal for most use cases. Is there any other possible workaround, besides the ones already provided, for this situation until the new release is launched? |
to avoid the problem the document that is being parsed must have a 'field/object' present in the last place in the array.
it would work if the ordering of fields was different
so some kind of preprocessing with sorting involved might solve this? so something like..
and
I am not sure if that would help, but can't thing of any other workaround |
We are using CBES (Couchbase to Elastic Connector) to stream documents from a Couchbase bucket to Elasticsearch. |
Just leaving a note to make sure we update the known-issue sections in our docs. |
while jackson 2.14.2 with FasterXML/jackson-core#882 is still not released we want to patch the jackson-core used by x-content with the modified class that fixes the bug #92480 closes #92480
while jackson 2.14.2 with FasterXML/jackson-core#882 is still not released we want to patch the jackson-core used by x-content with the modified class that fixes the bug elastic#92480 closes elastic#92480
fyi the fix was included in 8.6.1 release and is available for download now |
…rsing bug (elastic#93915) relates elastic#92480 relates elastic#92984
…rsing bug (elastic#93915) relates elastic#92480 relates elastic#92984
…rsing bug (elastic#93915) relates elastic#92480 relates elastic#92984
Elasticsearch Version
8.5.3
Installed Plugins
No response
Java Version
bundled
OS Version
n/a
Problem Description
In version 7.x of ES you can set an "includes" settings in the "_source" mapping definition for a field within a nested field.
If you are indexing a document that contains multiple nested fields where one of the fields does not contain a particular field, the document indexes without problems.
However, doing the same in version 8.5.3 fails with a "reason": "Unclosed object or array found".
Steps to Reproduce
Create a mapping like this:
Then index a document like this:
Receive error:
Logs (if relevant)
No response
The text was updated successfully, but these errors were encountered: