Error in visualization [lens_merge_tables] > [esaggs] > Cannot read property 'aggConfig' of undefined

Hi all, I am using ELK 7.5, facing an issue with the Lens in visualization, that is "[lens_merge_tables] > [esaggs] > Cannot read property 'aggConfig' of undefined", it happens when I drag fields into the panel of Lens. Since the data popped in was from "kibana_sample_data_ecommerce", I guess this was not a data problem.

How's x axis, y axis and break down by configured (which functions are you using)? Also, which version of Kibana are you running?

What's used for the "Break down by" dimension? In general a lot changed in the last few versions in Lens, if that's possible for you try upgrading your stack to see whether the problem persists.

Can you export the saved object from "Management" and paste it here?

  "name" : "jd-bj-bjy-elasticsearch008",
  "cluster_name" : "elk_bjy",
  "cluster_uuid" : "LPCe-w6sSCiI933GGNMXrA",
  "version" : {
    "number" : "7.5.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "e9ccaed468e2fac2275a3761849cbee64b39519f",
    "build_date" : "2019-11-26T01:06:52.518245Z",
    "build_snapshot" : false,
    "lucene_version" : "8.3.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  "tagline" : "You Know, for Search"

Sure I will install a newer version and see.

I think we had a misunderstanding, the saved object you posted is the index pattern, not the Lens visualization.

    "attributes": {
        "expression": "kibana\n| kibana_context  query=\"{\\\"query\\\":\\\"\\\",\\\"language\\\":\\\"kuery\\\"}\" filters=\"[]\"\n| lens_merge_tables layerIds=\"457d86b5-2310-42eb-86b5-6bc7b36e6005\" \n  tables={esaggs index=\"ff959d40-b880-11e8-a6d9-e546fe2bba5f\" metricsAtAllLevels=false partialRows=false includeFormatHints=true aggConfigs={lens_auto_date aggConfigs=\"[{\\\"id\\\":\\\"651741c1-903e-482b-aba0-211ee1d19422\\\",\\\"enabled\\\":true,\\\"type\\\":\\\"terms\\\",\\\"schema\\\":\\\"segment\\\",\\\"params\\\":{\\\"field\\\":\\\"customer_id\\\",\\\"orderBy\\\":\\\"_key\\\",\\\"order\\\":\\\"asc\\\",\\\"size\\\":3,\\\"otherBucket\\\":false,\\\"otherBucketLabel\\\":\\\"Other\\\",\\\"missingBucket\\\":false,\\\"missingBucketLabel\\\":\\\"Missing\\\"}}]\"} | lens_rename_columns idMap=\"{\\\"col-0-651741c1-903e-482b-aba0-211ee1d19422\\\":{\\\"label\\\":\\\"customer_id 的排名最前值\\\",\\\"dataType\\\":\\\"string\\\",\\\"operationType\\\":\\\"terms\\\",\\\"scale\\\":\\\"ordinal\\\",\\\"suggestedPriority\\\":1,\\\"sourceField\\\":\\\"customer_id\\\",\\\"isBucketed\\\":true,\\\"params\\\":{\\\"size\\\":3,\\\"orderBy\\\":{\\\"type\\\":\\\"alphabetical\\\"},\\\"orderDirection\\\":\\\"asc\\\"},\\\"id\\\":\\\"651741c1-903e-482b-aba0-211ee1d19422\\\"}}\"}\n| lens_xy_chart xTitle=\"customer_id 的排名最前值\" yTitle=\"y\" legend={lens_xy_legendConfig isVisible=true position=\"right\"} \n  layers={lens_xy_layer layerId=\"457d86b5-2310-42eb-86b5-6bc7b36e6005\" hide=false xAccessor=\"651741c1-903e-482b-aba0-211ee1d19422\" yScaleType=\"ordinal\" xScaleType=\"ordinal\" isHistogram=false splitAccessor=undefined seriesType=\"bar_stacked\"  columnToLabel=\"{}\"}",
        "state": {
            "datasourceMetaData": {
                "filterableIndexPatterns": [
                        "id": "ff959d40-b880-11e8-a6d9-e546fe2bba5f",
                        "title": "kibana_sample_data_ecommerce"
            "datasourceStates": {
                "indexpattern": {
                    "currentIndexPatternId": "ff959d40-b880-11e8-a6d9-e546fe2bba5f",
                    "layers": {
                        "457d86b5-2310-42eb-86b5-6bc7b36e6005": {
                            "columnOrder": [
                            "columns": {
                                "651741c1-903e-482b-aba0-211ee1d19422": {
                                    "dataType": "string",
                                    "isBucketed": true,
                                    "label": " Top Value of customer_id ",
                                    "operationType": "terms",
                                    "params": {
                                        "orderBy": {
                                            "type": "alphabetical"
                                        "orderDirection": "asc",
                                        "size": 3
                                    "scale": "ordinal",
                                    "sourceField": "customer_id",
                                    "suggestedPriority": 1
                            "indexPatternId": "ff959d40-b880-11e8-a6d9-e546fe2bba5f"
            "filters": [
            "query": {
                "language": "kuery",
                "query": ""
            "visualization": {
                "layers": [
                        "accessors": [
                        "layerId": "457d86b5-2310-42eb-86b5-6bc7b36e6005",
                        "position": "top",
                        "seriesType": "bar_stacked",
                        "showGridlines": false,
                        "splitAccessor": "70085991-6a75-44ae-9912-91c02200956c",
                        "xAccessor": "651741c1-903e-482b-aba0-211ee1d19422"
                "legend": {
                    "isVisible": true,
                    "position": "right"
                "preferredSeriesType": "bar_stacked",
                "title": "Empty XY chart"
        "title": "lensWithError",
        "visualizationType": "lnsXY"
    "id": "c45d2ca0-3f7b-11eb-a881-63223322643e",
    "references": [
    "type": "lens",
    "updated_at": "2020-12-16T08:50:37.290Z",
    "version": "WzIxODIsMTBd"
    "exportedCount": 1,
    "missingRefCount": 0,
    "missingReferences": [

Sorry now I understand and export it , named it with the title 'lensWithError'.
Could you kindly take a see of it?

Ah, I see, thanks for the saved object. You need to add something to the y axis as well (like the "Count of records"), otherwise the chart won't render. The error message improved a lot in more recent versions :slight_smile:

Thank you, now it works.

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