Can kibana uses alias for index pattern?


(Tan Vinh Nguyen) #1

Hi,

I can create for elasticsearch aliases, e.g. for all metrics-2015-10-01 to metrics-2015-10-nn the alias stats will be used.

curl -XPOST 'http://localhost:9200/_aliases' -d '
{
    "actions" : [
        { "add" : { "index" : "metrics*", "alias" : "stats" } }
    ]
}'

Is it possible for me to use the alias in Kibana. Obviously it doesn't seem to be case :frowning:

The reason, I'm asking is that the old index has mapping field conflicts. Therefore my intent is to use an alias and switch the index-pattern to the alias, so I don't have to change the dependent Kibana Objects (searches, visuals). Have any of you a recommendation?

Thanks in advance


(Tanya Bragin) #2

Yes, it should work on aliases. I tried the same exact example on my data, though instead of metrics-* I have logstash-* as my source indices. It works for me. Are you sure the index alias got created properly?


(Tan Vinh Nguyen) #3

Hello Mrs. Bragin, thank you for confirmation. Just tried it on a test instance, it did work. Have to test it at work again. But at least I know in this case it is working.


(Tan Vinh Nguyen) #4

Hello Mrs Bragin,

just checked on the prod machine. Indeed the alias was missing, I must have miss to executed my above command :blush:

Just checked now with list all aliases

dev@cinhtau:~> curl -XGET 'http://localhost:9200/*/_alias/*'
{
    "metrics-2015.10.01": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.12": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.02": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.13": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.09": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.05": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.11": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.15": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.04": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.10": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.14": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.06": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2025.10.02": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.08": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.16": {
        "aliases": {
            "stats": {}
        }
    },
    "metrics-2015.10.07": {
        "aliases": {
            "stats": {}
        }
    }
}

It is working, as you said. Alias is working in Kibana. Merci beaucoup.


#5

Doesn't this make Kibana not select proper indexes for selected time span?

We've tested such solution in our project and when having:

  • monthly indexes,
  • an alias with wildcard
  • index pattern = the alias
    then Kibana would generate queries that search all shards, regardless of the time picker setting. This was actually confirmed by Elastic support.

(Mehmet Γ–zer) #6

Hi,

I am currently trying to have a Kibana which will show me filtered dashboards, so I make a CURL with

{ "actions": [ { "add": { "index": "statistiques_sss-2017", "alias": "statistiques_vvv_xxx-2017", "filter": { "term": { "wsname": "intranet" } } } } ]}

When I am trying to point on statistiques_vvv_xxx* with my Kibana 5.1.1 I got no filters applied but when I point on statistiques_vvv_xxx-2017, I got my filters correctly. Can you please tell me if it is a bug ?

Thanks


(system) #7