Reputation: 3243
I have an existing index for which the default ElasticSearch similarity is used for all fields. I would like to update this index and set some other type of similarity, like BM25. The query I tried is:
curl -XPOST 'http://localhost:9200/myindex/' -d '
{
"settings":
{
"similarity":
{
"newSimilarity":
{
"type":"BM25"
}
}
}
}'
However, this crashes with an IndexAlreadyExists exception. I have also tried
curl -XPUT 'http://localhost:9200/doc/_mapping' -d '
{
"doc":
{
"properties":
{
"myField":
{
"type":"string",
"term_vector":"with_positions_offsets_payloads",
"similarity":"BM25"
}
}
}
}
And this gives me a MergeMappingException - [Merge failed with failures {[mapper [text_content] has different similarity. Setting ignore_conflicts to true doesn't really help, it ignores the conflicts but doesn't change the mapping.
Still, I would like to know if is it possible to update the similarity measure for all fields inside this index without having to reindex the data. Any suggestions would be much appreciated.
Thanks!
Upvotes: 4
Views: 923
Reputation: 17441
No at the moment elasticsearch does not allow changing the similarity on the fly . You would have to reindex. https://github.com/elasticsearch/elasticsearch/issues/4403
Upvotes: 3