Kibana filter on dashboard not working for Vega

I have a index named 'employees' with following mapping

"properties": {
  "employee_id": {
    "type": "long"
  },
  "employee_details": {
    "type": "nested",
    "dynamic": "false",
    "properties": {
      "city": {
        "type": "keyword"
      },
      "employee_type": {
        "type": "keyword"
      }
    }
  }
}

Based on the index documents, I have created kibana dashboard with multiple widgets in it.
I noticed that we can filter the data in the dashboard using KQL

or using filters

Problem:
I noticed that the query generated by using KQL and Filter is different for Vega widgets.

For KQL the query was as below which is correct.

{
  "aggs": {},
  "size": 0,
  "query": {
    "bool": {
      "must": [],
      "filter": [
        {
          "nested": {
            "path": "employee_details",
            "query": {
              "bool": {
                "should": [
                  {
                    "match_phrase": {
                      "employee_details.employee_type": "PERMANENT"
                    }
                  }
                ],
                "minimum_should_match": 1
              }
            },
            "score_mode": "none"
          }
        }
      ]
    }
  }
}

But the query generated using the filter is incorrect for Vega widgets

{  
  "size": 0,
  "query": {
    "bool": {
      "filter": [
        {
          "match_phrase": {
            "employee_details.employee_type": "PERMANENT"
          }
        }
      ],
      "should": [],
      "must_not": []
    }
  }
}

I failed to understand why these queries are different only for Kibana widgets.
Can somebody please help?

Hey there, did you pass Kibana context to your Vega script? "%context%": true

Yes, I already pass the "%context%": true property in vega chart

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