Upgrading index with custom similarity not working


I use a custom similarity and since the switch to elasticsearch 5 I can't upgrade existing indices using this custom similarity.

The Plugin code registers the custom similarity as follows:

public void onIndexModule(IndexModule module) {
    module.addSimilarity("searchchsimilarity", SearchChSimilarityProvider::new);

And the indices use this similarity as default by setting:

"settings": {
    "similarity": {
        "default": {
            "type": "searchchsimilarity"

This works when creating new indices, but if I want to upgrade an index from an older elasticsearch version (either by restoring a snapshot or by starting a newer elasticsearch on the server), I get the following errors:

What am I doing wrong? Or is this a bug?

No help here? There have to be others with the same problem. I'm happy to give more info if necessary or test some stuff.

Hi Nathan,

I did not try to upgrade, but I expect it to fail. Elastic changed the way a similarity is configured, so it might or might not succeed.

Did you check the code? I mean from the stacktrace? The inner exception states that it cannot find your similarity…

It is AFAIK configurable afterwards via a put settings. So, you could try to remove the similarity in the old ES, open it in the new ES and re-apply the similarity.

A different approach would be to just reindex the complete index.

Hope this helps a bit.

Kind regards,

yeah, i've seen that. the strange thing is, that I can create a new index using the very same similarity name with no problems. thats why I think that either my way of registering a custom similarity is wrong or elasticsearch 5 has a bug here.

Thats a good idea and I will probably do an upgrade this way next week. Still that was not necessary with elasticsearch 2.4.

Thanks a lot for your answer.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.