I am using Elasticsearch as a datasounce in Grafana. I want to create a template, that will display all the options, for a specific field.
For example, I have the following fields: status, code2, check, category.
I want to create a template with the field called code2, so i can select from a dropdown the options under code2.
In Templates, I created the following query to select code2:
{ “find”: “fields”, “field”: “code2”, “type”:“string”}
Instead of selecting the particular field, this returns all fields.
In preview values I see the following:
status, code2, check, category
Actually, i can see the field I want to select is inside _source tag, as below:
{
"_index" : “private”,
"_type" : “logs”,
"_id" : “xyz”,
"_source" : {
“value1” : “xyzxyz”,
“value2” : null,
“code2” : “xxx”,
}
}
How do I select code2 from the _source tag for the query?
Thanks, I see I can see i can use terms instead. When changing my Json, it seems it works well for fields outside of source like index, type, id, they get returned. It seems I cannot get the fields inside _source though. When I specify code2, it doesn’t return anything. Any suggestion?