feature: column aliases in cat indices API #1236
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feature: allow column (
?h=
) aliases incat indices API
Why this should be part of the repo?
This repository allows to call any elastic request, so if elastic can execute
http://localhost:9200/_cat/indices?h=idx
, then this repo should too. (havingidx
instead ofindex
)Implementation
cat_indices.go
, when url is built - given columns are looked up in the alias map and replaced if anyrefresh.time
orrefresh.external_time
, and they both haverti
alias)init()
function). It usesreflect
, but as it's one-time on-startup call, I consider this not harmful.Other option (to avoid reflect) is to manually declare the alias map. But this approach has a drawback as well: we declare fields in two places manually: the
CatIndicesResponseRow
struct and the aliases map. And when updating further, developer is required to update BOTH things, so it will become a danger place that can admit bugs when developer updates one thing and forgets about other.?h=h
to be the same as?h=health
?h=rti