user3658423
user3658423

Reputation: 1944

elasticsearch disable index create and delete operations

I am using Elasticsearch 1.5.2

I have a setup script that creates all the necessary indexes and mappings for my application.

After I create these indexes, I do NOT want to create new indexes or delete existing ones. (Either manually or by some unintentional execution from my app)

Is it possible to set any configurations in elasticsearch and restart the service to achieve the above?

Thanks

Upvotes: 2

Views: 3758

Answers (1)

Val
Val

Reputation: 217344

According to the official Index API documentation, you can disable automatic index creation by adding the following setting to the elasticsearch.yml file on all your nodes:

action.auto_create_index: false

You can also prevent automatic mapping creation (i.e. when adding new fields that are not in your initial mapping, by adding this to your configuration:

index.mapper.dynamic: false

As for preventing index deletion via a wildcard /* or /_all, one thing you can do is to add the following settings to your config file, too (it can also be done dynamically via /_cluster/settings):

action.destructive_requires_name: true

Aside from that, I'm afraid there's not much that you can do to prevent the deletion of a named index, except making sure your code doesn't contain any DELETE statement. I don't know enough of your environment, but one way could be to proxy your ES behind Apache or Nginx and configure it to deny all DELETE HTTP requests, but that would also prevent you from deleting documents.

Upvotes: 7

Related Questions