Skip to content

Incorrect synthetic source for object arrays withtin nested objects #115261

@lkts

Description

@lkts

For object arrays that are within nested object and contain leaf values that are "mixed" (some synthetic source values come from doc_values and some from ignored source) synthetic source is not correct.

Following test demonstrates that:

    public void testObjectArrayWithinNestedObjects() throws IOException {
        DocumentMapper documentMapper = createMapperService(syntheticSourceMapping(b -> {
            b.startObject("path").startObject("properties");
            {
                b.startObject("to").field("type", "nested").startObject("properties");
                {
                    b.startObject("obj").startObject("properties");
                    {
                        b.startObject("id").field("type", "integer").field("synthetic_source_keep", "arrays").endObject();
                    }
                    b.endObject().endObject();
                }
                b.endObject().endObject();
            }
            b.endObject().endObject();
        })).documentMapper();

        var syntheticSource = syntheticSource(documentMapper, b -> {
            b.startObject("path");
            {
                b.startObject("to");
                {
                    b.startArray("obj");
                    {
                        b.startObject().array("id", 1, 20, 3).endObject();
                        b.startObject().field("id", 10).endObject();
                    }
                    b.endArray();
                }
                b.endObject();
            }
            b.endObject();
        });
        assertEquals("""
            {"path":{"to":{"obj":{"id":[1,20,3,10]}}}}""", syntheticSource);
    }

This test produces {"path":{"to":{"obj":{"id":[1,20,3]}}}}.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions