Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support YAML in Dev Tools -> Console #28754

Open
4 tasks
ypid-geberit opened this issue Jan 15, 2019 · 9 comments
Open
4 tasks

Support YAML in Dev Tools -> Console #28754

ypid-geberit opened this issue Jan 15, 2019 · 9 comments
Labels
enhancement New value added to drive a business result Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@ypid-geberit
Copy link

ypid-geberit commented Jan 15, 2019

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

  • Basic support to accept YAML as request. (ES supports this so you just need to set the Content-Type: application/yaml in the request. ES will then also answer YAML encoded.)
  • Folding support.
  • Optional, might be out of scope: Conversion between YAML and JSON in the Console to have the best of both worlds.
  • Request completion.

Example:

GET index/_search
---

size: 5

_source:
  - 'license'
  - 'name'

query:
  query_string:
    query: '+license:("GPL-3.0-only" OR "AGPL-3.0-only")'
...
@jen-huang jen-huang added Feature:Console Dev Tools Console Feature enhancement New value added to drive a business result Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Jan 15, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@yaronp68
Copy link

@ypid-geberit
Thank you for opening this issue. Any other reason for using YAML other than the two you have mentioned above?

@ypid-geberit
Copy link
Author

ypid-geberit commented Jan 22, 2019

I might add that I use YAML all over the place together with Elasticsearch. For example to write ES watches (elastic/examples#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:

  • YAML is known to people from other places in the Elastic Stack.

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.

@CommanderTso
Copy link

CommanderTso commented Jan 25, 2019

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

@tdmalone
Copy link

^ or even:

GET blogs/_search
query.match.title.query: "open source software"
query.match.title.minimum_should_match: 2

@phoerious
Copy link

I'd love this feature. I spend about 50% of my time counting closing brackets.

@yosbeleg89
Copy link

yosbeleg89 commented May 25, 2020

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;

@i0
Copy link

i0 commented Jun 25, 2021

Please consider adding this feature!

@alisonelizabeth alisonelizabeth removed the good first issue low hanging fruit label Aug 30, 2024
@alisonelizabeth alisonelizabeth removed the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Sep 17, 2024
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 17, 2024
@alisonelizabeth alisonelizabeth added the Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more label Sep 17, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

No branches or pull requests