Skip to content

Elasticsearch: Selecting/templating time field for date histogram #12519

Description

@hackery

Grafana 5.1.4, Elasticsearch datasource, Windows 7

I'm looking to provide a dashboard control to select which time field in documents is used for date histograms. This seems straightforward by creating a template variable with a list of field names (@timestamp, time, startTime, endTime, firstSeen etc) and referring to it in the grouping clause of the query editor:

image

image

However, Grafana doesn't accept a variable entered here - it reverts the entry back to the default @timestamp value. Actually, it also reverts if I select another date-typed field like time here - so perhaps this selector box has a more generic issue than templating. Should a variable be usable here?

(I've verified that when the /api/datasources/proxy/6/my-index-*/_mapping XHR call is made, the returned mapping is showing 'date' type for both relevant fields, as might be expected seeing the autocomplete options.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions