# Reset similarity on an index

**URL:** https://discuss.elastic.co/t/reset-similarity-on-an-index/332652
**Category:** Elasticsearch
**Created:** [May 5, 2023, 1:13pm UTC](https://discuss.elastic.co/t/reset-similarity-on-an-index/332652 "2023-05-05T13:13:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![slayer](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@slayer](https://discuss.elastic.co/u/slayer)
#### Post date: [May 5, 2023, 1:13pm UTC](https://discuss.elastic.co/t/reset-similarity-on-an-index/332652/1 "2023-05-05T13:13:30Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [May 5, 2023, 5:46pm UTC](https://discuss.elastic.co/t/reset-similarity-on-an-index/332652/2 "2023-05-05T17:46:06Z")

</div>

Hi @slayer

The error occurs because the parameters do not exist for the [BM25](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-similarity.html#bm25).  
You can try to return with just the type name.

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

```

---

<div class="post-metadata">

### Author: ![slayer](https://avatars.discourse-cdn.com/v4/letter/s/96bed5/32.png) [@slayer](https://discuss.elastic.co/u/slayer)
#### Post date: [May 6, 2023, 3:53am UTC](https://discuss.elastic.co/t/reset-similarity-on-an-index/332652/3 "2023-05-06T03:53:49Z")

</div>

Hi @RabBit_BR ,

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

The steps I have followed are:

POST index/\_close

PUT index/\_settings

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

```

POST index/\_open

This is the error I get:

```auto
{
    "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
}

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [June 3, 2023, 3:54am UTC](https://discuss.elastic.co/t/reset-similarity-on-an-index/332652/4 "2023-06-03T03:54:23Z")

</div>

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