Kibana Visualize Lens not showing nested fields

I'm not sure what I did wrong, but Kibana Lenses aren't showing me the nested field inventory.equipment. In terms of what I did, I set up an index and added a document with this script:

PUT warehouse
POST warehouse/_mapping
{
  "properties": {
    "inventory": {
      "type": "nested",
      "properties": {
        "equipment": {
          "type": "keyword"
        },
        "price": {
          "type": "float"
        }
      }
    },
    "profile": {
      "properties": {
        "name": {
          "type": "keyword"
        }
      }
    }
  }
}

POST warehouse/_doc
{
  "profile": {
    "name": "Texas"
  },
  "inventory": [
    {"equipment":"guitar", "price": 20.00},
    {"equipment":"book", "price": 25.00}
  ]
}

But the drop down on the far right only shows profile.name. It's not showing inventory.equipment:

What did I do wrong?

Nested fields area not supported yet in Visualizations: Nested field support in Visualize · Issue #58175 · elastic/kibana · GitHub

Thanks @Marco_Liberati , your other alternative to use vega instead of kibana lens also worked great. It was:

{
/*

Welcome to Vega visualizations.  Here you can design your own dataviz from scratch using a declarative language called Vega, or its simpler form Vega-Lite.  In Vega, you have the full control of what data is loaded, even from multiple sources, how that data is transformed, and what visual elements are used to show it.  Use help icon to view Vega examples, tutorials, and other docs.  Use the wrench icon to reformat this text, or to remove comments.

This example graph shows the document count in all indexes in the current time range.  You might need to adjust the time filter in the upper right corner.
*/

  $schema: https://vega.github.io/schema/vega-lite/v5.json
  title: Average Price per instrument

  // Define the data source
  data: {
    url: {
      // Which index to search
      index: warehouse
      // Aggregate data by the time field into time buckets, counting the number of documents in each bucket.
      body: {
        "aggs": {
          "inventory": {
            "nested": {
              "path": "inventory"
            },
            "aggs": {
              "equip": {
                "terms": {
                  "field": "inventory.equipment.keyword"
                },
                "aggs": {
                  "avg_price": {
                    "avg": {
                      "field": "inventory.price"
                    }
                  }
                }
              }
            }
          }
        }
        // Speed up the response by only including aggregation results
        size: 0
      }
    }
/*


For our graph, we only need the list of bucket values.  Use the format.property to discard everything else.
*/
    format: {property: "aggregations.inventory.equip.buckets"}
  }

  // "mark" is the graphics element used to show our data.  Other mark values are: area, bar, circle, line, point, rect, rule, square, text, and tick.  See https://vega.github.io/vega-lite/docs/mark.html
  mark: bar

  // "encoding" tells the "mark" what data to use and in what way.  See https://vega.github.io/vega-lite/docs/encoding.html
  encoding: {
    x: {
      // The "key" value is the timestamp in milliseconds.  Use it for X axis.
      field: key
      type: ordinal
      axis: {title: "Instrument"} // Customize X axis format
    }
    y: {
      // The "doc_count" is the count per bucket.  Use it for Y axis.
      field: avg_price.value
      type: quantitative
      axis: {title: "Average Price"}
    }
  }
}

Typing mistake here....need to change:

"field": "inventory.equipment.keyword"

To

"field": "inventory.equipment"

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.