Open ypid-geberit opened 5 years ago
Pinging @elastic/es-ui
@ypid-geberit Thank you for opening this issue. Any other reason for using YAML other than the two you have mentioned above?
I might add that I use YAML all over the place together with Elasticsearch. For example to write ES watches (https://github.com/elastic/examples/pull/239) and thus also for queries. When you use Curator, you also end up writing queries in YAML. YAML is already present in Elasticsearch and people know/use it. Even the configuration file of Kibana is in YAML.
To summaries this:
That is a third reason but the two reasons I mentioned already are my main reasons. I can go into more depth on those two if you want to.
I am taking the Engineer I training right now, and was thinking this would be great to have.
To elaborate on the "human editable and readable" part, YAML support would allow for much more concise queries while cutting down on the need for fiddly braces, quote marks, and commas.
For example, this:
GET blogs/_search
{
"query": {
"match": {
"title": {
"query": "open source software",
"minimum_should_match": 2
}
}
}
}
Becomes:
GET blogs/_search
query:
match:
title:
query: "open source software"
minimum_should_match: 2
^ or even:
GET blogs/_search
query.match.title.query: "open source software"
query.match.title.minimum_should_match: 2
I'd love this feature. I spend about 50% of my time counting closing brackets.
Another good reason could be to have multiline strings for scripts in YAML.
GET hockey/_search
{
"query": {
"match_all": {}
},
"script_fields": {
"total_goals": {
"script": {
"lang": "painless",
"source": "int total = 0; for (int i = 0; i < doc['goals'].length; ++i) { total += doc['goals'][i]; } return total;"
}
}
}
}
becomes:
query:
match_all: {}
script_fields:
total_goals:
script:
lang: painless
source: >
int total = 0;
for (int i = 0; i < doc['goals'].length; ++i) {
total+= doc['goals'][i];
}
return total;
Please consider adding this feature!
Pinging @elastic/kibana-management (Team:Kibana Management)
Describe the feature: Most APIs of Elasticsearch support YAML requests and ES can send responses also in YAML. Please consider supporting it also in Dev Tools -> Console. For completeness, "raw" filter blocks ("Edit Query DSL") should then also support YAML.
Describe a specific use case for the feature:
Stages of implementation
Content-Type: application/yaml
in the request. ES will then also answer YAML encoded.)Example: