In my elastic search server I have one index http://localhost:9200/blog
.
The (blog) index contains multiple types.
e.g.: http://localhost:9200/blog/posts
, http://localhost:9200/blog/tags
.
In the tags type I have created more than 1000 tags and 10 posts created in posts type.
e.g.: posts
{
"_index":"blog",
"_type":"posts",
"_id":"1",
"_version":3,
"found":true,
"_source" : {
"catalogId" : "1",
"name" : "cricket",
"url" : "http://www.wikipedia/cricket"
}
}
e.g.: tags
{
"_index":"blog",
"_type":"tags",
"_id":"1",
"_version":3,
"found":true,
"_source" : {
"tagId" : "1",
"name" : "game"
}
}
I want to assign the existing tag to blog posts (i.e. relationship => mapping).
How do I assign the tags to posts mapping?
There are 4 approaches that you can use within Elasticsearch for managing relationships. They are very well outlined in the Elasticsearch blog post - Managing Relations Inside Elasticsearch I would recommend reading the entire article to get more details on each approach and then select that approach that best meets your business needs while remaining technically appropriate.
Here are the highlights for the 4 approaches.