How do I search nested elements

“tags”: {
“type”: “nested”,
“properties”: {
“name”: {
“type”: “string”,
“index”: “not_analyzed”
},
“value”: {
“type”: “string”,
“index”: “not_analyzed”
},
// more fields, snipped
}
},

my index’s mapping is as above
ES version:5.4.3
Grafana version:4.5.0

I want to figure out the count of documents with “tags.name” field exist.
IS the nested query supported by Grafana?
and can i write user-defined DSL in Grafana?

1 Like

type in the query field a lucene query that checks if tags.name exists (check elasticsearch docs for lucene query syntax)


and How do I edit this request data

you cannot edit that directly, you have to use the query editor UI (add metrics, and group bys)

image

i want to query a nested field “tags.name”,but found it doesn’t function. help!ths

1 Like

that looks like a valid lucene query, should work. try tags.name:'apple'

I have the same issue but does not work. Also, i need to use metrics other than count but all the values obtained in the response are null. Following is my document structure:

{
        "_index": "1",
        "_type": "_doc",
        "_id": "2018-11-12 7:00:00 - 2018-11-12 7:30:00",
        "_score": 1,
        "_source": {
          "start": "2018-11-12 7:00:00"
          "obj1": [
            {
              "key1": "value",
              "key2": "value",
              "key3": "value",
            },
            {
              "key1": "value",
              "key2": "value",
              "key3": "value",
            }
          ],
        
        }
      }

where type of obj1 is nested

If the type of obj1 is not kept nested then correct values are returned in the response

@kaiwalya did you figure out a way ?

@kaiwalya ? Did you resolve your mentioned problem ? or Anybody know How can I use aggs with nested object as @kaiwalya 's example