elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
69.42k stars 24.57k forks source link

Dry run configs like index templates #63019

Open shenwan opened 3 years ago

shenwan commented 3 years ago

We plan to store index templates in Phabricator and would like to validate a diff before landing it and HTTP PUT to ES.

Without dry-run support, we would have to either hope that the new config does not break ES, or find a way to hack some local ES instance to apply the config to.

A dry-run param in the HTTP PUT request should be easy to implement and would make API users' life much easier.

dakrone commented 3 years ago

@shenwan maybe you can clarify, when you say "does not break ES", how does ES break when putting a template in place?

Also, what would a dry-run parameter actually do? We already have an API to simulate adding an index template: https://www.elastic.co/guide/en/elasticsearch/reference/7.9/indices-simulate-template.html

elasticmachine commented 3 years ago

Pinging @elastic/es-core-features (:Core/Features/Indices APIs)

shenwan commented 3 years ago

"Break ES" includes having ES running in an unintended way. For example, if the new config sets incorrect priorities, how can we find that out?

The experimental _simulate API seems to work. Thanks for the info! I think at first we will just check if the API returns 200. But maybe we should also check if the response body is expected?

Also, are you going to build similar _simulate API for other configs? e.g. for ILM policy? Would it be easier to add a "?dry-run=true" param to each API instead?

shenwan commented 3 years ago

ping