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

[Console] Support index template comments #64260

Closed
a03nikki opened this issue Apr 22, 2020 · 4 comments
Closed

[Console] Support index template comments #64260

a03nikki opened this issue Apr 22, 2020 · 4 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

@a03nikki
Copy link
Contributor

Describe the feature:

In Dev Tool's Console, it would be helpful if it did not mark comments in templates as errors and would align the JSON as well.

Describe a specific use case for the feature:

It causes confusion as the comment lines are marked as errors. Plus, the "Auto indent" stops working when comments are present.

For example, let's take this example without the leading white space

PUT _template/test_1
{
"index_patterns": ["test-*"],
"mappings": {
"properties": {
"http": {
"properties": {
"session": {
"properties": {
"id": {
"type": "keyword"
}
}
}
}
}
}
}
}

✅ Without the comment, if you run "Auto indent" on it, the leading white space is added back in

PUT _template/test_1
{
  "index_patterns": [
    "test-*"
  ],
  "mappings": {
    "properties": {
      "http": {
        "properties": {
          "session": {
            "properties": {
              "id": {
                "type": "keyword"
              }
            }
          }
        }
      }
    }
  }
}

However, if a comment is thrown into the mix

PUT _template/test_1
{
"index_patterns": ["test-*"],
"mappings": {
"properties": {
"http": {
"properties": {
"session": {
/* custom field */
"properties": {
"id": {
"type": "keyword"
}
}
}
}
}
}
}
}

🔴 It does not format.

To save your eyes, here is same text manually aligned but with the comment

PUT _template/test_1
{
  "index_patterns": [
    "test-*"
  ], 
  "mappings": {
    "properties": {
      "http": {
        "properties": {
          "session": {
            /* custom field */
            "properties": {
              "id": {
                "type": "keyword"
              }
            }
          }
        }
      }
    }
  }
}

🔴 But in Kibana, it says there is an error despite it being a valid API call.
Screenshot_2020-04-22 Kibana

Although the comments are not stored with the template in Elasticsearch. It would be helpful if Console would handle them gracefully.

The above simple example is based on when I was creating a custom index template using the ECS template as the base of my new one. I wanted to comment which fields were custom for easy (future) identification.

@a03nikki a03nikki added Feature:Console Dev Tools Console Feature Feature:Dev Tools labels Apr 22, 2020
@jloleysens jloleysens added 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 Aug 26, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@cjcenizal
Copy link
Contributor

Although the comments are not stored with the template in Elasticsearch. It would be helpful if Console would handle them gracefully.

@a03nikki Is part of your request that Elasticsearch also store the comments? The reason I ask is that we already have a feature request open for supporting comments in the request body in Console (#11973), except it doesn't mention preserving these comments in Elasticsearch. If that's not part of your request then we can close this issue as a duplicate.

@a03nikki
Copy link
Contributor Author

@cjcenizal : No, I was not intending to make the request to also store them in Elasticsearch.
I must have not been searching the right terms to find #11973. If that ticket will also handle the "Auto indent" functionality, then this can be closed as a duplicate.

@cjcenizal
Copy link
Contributor

Closing in favor of #11973.

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

4 participants