Let's say I have a tag
type in an ElasticSearch index, with the following mapping:
{
"tag": {
"properties": {
"tag": {"type": "string", "store": "yes"},
"aliases": {"type": "string"}
}
}
}
Each entry is a tag, and an array of aliases to that tag. Here is an example item:
{
"word": "weak",
"aliases": ["anemic", "anaemic", "faint", "flimsy"]
}
From time to time, I want to add new tag words with their aliases, and add new aliases to existing tag words.
Adding new tag words with their aliases is easy, it's just a new Document. However, how can I add new aliases to existing tag words in a sane way?
I know I can just search for the tag word, get its document, search to see if the alias already exists in the array of aliases, if not add it, than save. However - this does not sound like a good solution.
Is there a way to do a bulk update?
_index
and_type
fields in everyupdate: {}
object, as it is already specified in request URL:http://127.0.0.1:9200/myindex/type/_bulk
– Cheerio