Search code examples
elasticsearchelasticsearch-6kibana-6

Aggregating Nested Fields in Kibana /Elastic Search


I have defined an Index in elastic cache 6

PUT my_index
{
 "mappings": {
  "_doc": {
  "properties": {
    "user": {
      "type": "nested" 
       }
      }
     }
  }
 }

and loaded some same data as follows

 PUT my_index/_doc/1
{
 "group" : "coach",
"user" : [
    {
    "first" : "John",
    "last" :  "Frank"
   },
   {
    "first" : "Hero",
    "last" :  "tim"
   }
  ]
}

PUT my_index/_doc/2
{
 "group" : "team",
"user" : [
    {
    "first" : "John",
    "last" :  "term"
   },
   {
    "first" : "david",
    "last" :  "gayle"
   }
  ]
}

Now I am trying to search in the discover page or the visualization page, but I receive a blank

Loaded Data

Discover Search Results

Visualization


Solution

  • after a bit of trial and error and googling around i found that does not support nested type for aggregation and search out of the box. To enable this you must install a plugin and the best plugin i found is listed below.

    https://ppadovani.github.io/knql_plugin/overview/

    The plugin provides all the features from the discover tab to the visualization tab.