Reputation: 139
I am looking for a way to index an embedded objects fields on the root/parent level. So if I have a news article with tags, and that news article contains a picture with tags, I'd like the pictures tags to be index on the top level so I don't have to specify a path into the picture when searching. So when indexing an object like the following…
{
title: "my news article",
tags: ["tag1", "tag2"],
picture: {
url: "http://domain.com/path/to/image.jpg",
tags: ["tag2", "tag3"]
}
}
I'd like to just specify to search only the "tags" field off of my article index and still get a result when searching for the term "tag3".
Something similar to how elastic search can move a nested objects fields to the parent/root with "include_in_parent" and "include_in_parent". Nested Type
Upvotes: 1
Views: 204
Reputation: 4623
There's no straightforward way to accomplish this by annotation config.
But you can use a custom FieldBridge for the picture
field. Inside your implementation of the FieldBridge
, you will handle the special use case and add the picture.tags
elements to the tags
field of the index document.
Upvotes: 3