Reset similarity on an index

Hi all,
I have changed the default similarity from BM25 to scripted similarity on one of my indices.
Now If I try to change it back to BM25, I am facing an error:

Unknown settings for similarity of type [BM25]: [script.source, weight_script.source]

How do I remove parameters from previous similarity setting before changing to new one?

Hi @slayer

The error occurs because the parameters do not exist for the BM25.
You can try to return with just the type name.

{
  "index": {
    "similarity": {
      "my_similarity": {
        "type": "BM25"
      }
    }
  }
}

Hi @RabBit_BR ,

Thanks for the reply. Unfortunately, the error still exists.

The steps I have followed are:

POST index/_close

PUT index/_settings

{
    "index": {
        "similarity": {
            "default": {
                "type": "BM25"
            }
        }
    }
}

POST index/_open

This is the error I get:

{
    "error": {
        "root_cause": [
            {
                "type": "illegal_argument_exception",
                "reason": "Unknown settings for similarity of type [BM25]: [script.source, weight_script.source]"
            }
        ],
        "type": "illegal_argument_exception",
        "reason": "Unknown settings for similarity of type [BM25]: [script.source, weight_script.source]"
    },
    "status": 400
}

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