Elasticsearch uses embedded objects to store documents (like in document 1 for comments)
//Document 1
{
"title": "Nest eggs",
"body": "Making your money work...",
"tags": [ "cash", "shares" ],
"comments": [
{
"name": "John Smith",
"comment": "Great article",
"age": 28,
"stars": 4,
"date": "2014-09-01"
},
{
"name": "Alice White",
"comment": "More like this please",
"age": 31,
"stars": 5,
"date": "2014-10-22"
}
]
}
Is it possible instead of nested object to pass only ids and somehow ask elasticsearch to fill appropriate data instead of it (assuming that we already have documents for comments with id and other data).
So generally I want to pass something like document 2, but I want document 1 to be saved (so "John Smith" comment is saved instead of comment_id 123, so I can use "comment's author name" for search).
//Document 2
{
"title": "Nest eggs",
"body": "Making your money work...",
"tags": [ "cash", "shares" ],
"comments": [
123, 124
]
}
The reason for this question is that for my particular case "comment" actually stored in different schema (different microservice). So i don't want, if possible, to make request to different microservice to find comment by id before saving whole document in elastisearch.
I'm new to elasticsearch, so sorry for possible begginer questions, but I haven't found anything like this in documentation.
Thanks