# Cannot apply "knn.model.index.number\_of\_shards" cluster setting in AWS environment

**URL:** <https://forum.opensearch.org/t/cannot-apply-knn-model-index-number-of-shards-cluster-setting-in-aws-environment/13528>\
**Category:** k-NN\
**Tags:** troubleshoot\
**Created:** [March 23, 2023, 8:45pm UTC](https://forum.opensearch.org/t/cannot-apply-knn-model-index-number-of-shards-cluster-setting-in-aws-environment/13528 "2023-03-23T20:45:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![monad](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/monad/32/5201_2.png) [@monad](https://forum.opensearch.org/u/monad)\
**Post date:** [March 23, 2023, 8:45pm UTC](https://forum.opensearch.org/t/cannot-apply-knn-model-index-number-of-shards-cluster-setting-in-aws-environment/13528/1 "2023-03-23T20:45:54Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
1.3  
2.x

**Describe the issue** :  
Hi, I am unable to apply “knn.model.index.number\_of\_shards” in our production environment in AWS opensearch. I am able to apply this configuration when running a local docker image of opensearch.

**Configuration** :  
Here is the following request

```auto
PUT /_cluster/settings
{
  "persistent": {
    "knn.model.index.number_of_shards": "22"
   }
}

```

This request succeeds on my local container but fails when ran against AWS opensearch with the error:

```auto
✖ RestResponseError: HTTP 401: { Message: "Your request: '/_cluster/settings' payload is not allowed." }
 PUT https://<domain>.com/_cluster/settings

```

Oddly enough I am able to run all other cluster settting changes, for example the following succeeds in both envs:

```auto
PUT /_cluster/settings
{
   "persistent":{
      "knn.plugin.enabled": true,
      "knn.algo_param.index_thread_qty": 20,
      "knn.cache.item.expiry.enabled": true,
   }
}

```

I have tested this on AWS Opensearch 1.3 and 2.x.

* * *

Here is what `GET /_cluster/settings` looks like on the working/not working instances.

AWS Opensearch (where it does not work):

```auto
{
  "persistent" : {
    "action" : {
      "auto_create_index" : "false"
    },
    "cluster" : {
      "routing" : {
        "allocation" : {
          "cluster_concurrent_rebalance" : "2",
          "node_concurrent_recoveries" : "2",
          "disk" : {
            "watermark" : {
              "low" : "7.355635070800781gb",
              "flood_stage" : "2.451878356933594gb",
              "high" : "4.903756713867188gb"
            }
          },
          "node_initial_primaries_recoveries" : "4",
          "awareness" : {
            "force" : {
              "zone" : {
                "values" : "xx-xxxxx-xx,xx-xxxxx-xx"
              }
            }
          },
          "load_awareness" : {
            "provisioned_capacity" : "2",
            "skew_factor" : "50.0"
          }
        }
      }
    },
    "indices" : {
      "recovery" : {
        "max_bytes_per_sec" : "20mb"
      }
    },
    "knn" : {
      "algo_param" : {
        "index_thread_qty" : "20"
      },
      "cache" : {
        "item" : {
          "expiry" : {
            "enabled" : "true"
          }
        }
      },
      "circuit_breaker" : {
        "triggered" : "false"
      },
      "memory" : {
        "circuit_breaker" : {
          "limit" : "50%"
        }
      },
      "plugin" : {
        "enabled" : "true"
      }
    },
    "plugins" : {
      "index_state_management" : {
        "metadata_migration" : {
          "status" : "1"
        },
        "template_migration" : {
          "control" : "-1"
        }
      }
    }
  },
  "transient" : {
    "cluster" : {
      "routing" : {
        "allocation" : {
          "disk" : {
            "watermark" : {
              "low" : "7.355635070800781gb",
              "flood_stage" : "2.451878356933594gb",
              "high" : "4.903756713867188gb"
            }
          },
          "node_initial_primaries_recoveries" : "4",
          "awareness" : {
            "force" : {
              "zone" : {
                "values" : "xx-xxxxx-xx,xx-xxxxx-xx"
              }
            }
          },
          "load_awareness" : {
            "provisioned_capacity" : "2",
            "skew_factor" : "50.0"
          },
          "cluster_concurrent_rebalance" : "2",
          "node_concurrent_recoveries" : "2",
          "exclude" : { }
        }
      },
      "max_shards_per_node" : "5100"
    },
    "indices" : {
      "recovery" : {
        "max_bytes_per_sec" : "20mb"
      }
    }
  }
}

```

* * *

Local container (where it does work):

```auto
{
  "persistent" : {
    "action" : {
      "auto_create_index" : "false"
    },
    "knn" : {
      "algo_param" : {
        "index_thread_qty" : "20"
      },
      "cache" : {
        "item" : {
          "expiry" : {
            "enabled" : "true"
          }
        }
      },
      "model" : {
        "index" : {
          "number_of_shards" : "22"
        }
      },
      "plugin" : {
        "enabled" : "true"
      }
    },
    "plugins" : {
      "index_state_management" : {
        "template_migration" : {
          "control" : "-1"
        }
      }
    }
  },
  "transient" : {
    "cluster" : {
      "max_shards_per_node" : "5100"
    }
  }
}

```

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![jmazane](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@jmazane](https://forum.opensearch.org/u/jmazane)\
**Post date:** [April 19, 2023, 2:12am UTC](https://forum.opensearch.org/t/cannot-apply-knn-model-index-number-of-shards-cluster-setting-in-aws-environment/13528/2 "2023-04-19T02:12:49Z")

</div>

Hey sorry for delay @monad. Out of curiosity why do you want that setting changed?

Some settings in the managed service cannot be changed dynamically. If you need it to be changed, you could reach out to AWS support for assistance.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/3/33547ea01a5b12dcca2958411d3edd97ae2ea8c1.png) [@system](https://forum.opensearch.org/u/system)\
**Post date:** [June 18, 2023, 2:12am UTC](https://forum.opensearch.org/t/cannot-apply-knn-model-index-number-of-shards-cluster-setting-in-aws-environment/13528/3 "2023-06-18T02:12:54Z")

</div>

Closed on June 18, 2023, 2:12am UTC

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