How to join relationships in between indexes

I have two index as
mxcel_schedule_appoint and mxcel_schedule staff
both indexes has a common field as staff_id

I want t use relationship field in between in these two indexes to get the no of visits for each staff based on the count from schedule_appoint index.

merging those indexes is not working for me.
I'm trying to visualize it by writing custom code in vega

{
  "$schema": "https://vega.github.io/schema/vega-lite/v2.json",
  "data": {
    "url": {
      "index": ["mxcel_schedule_appoint","mxcel_schedule_staff"]
      "%context%": true,
      "body": {"size": 10000}     
    },
    "transform":
    {
  "source": {
    "index": ["mxcel_schedule_appoint", "mxcel_schedule_staff"]
  },
  "pivot": {
    "group_by": {
      "id": {"terms": {
        "field": "staff_id"
      }}
    },
    "format": {"property": "hits.hits"}
  },
  "mark": "bar",
  "encoding": {
    "tooltip": {"field": "_source.staff_name", "type": "ordinal"},
    "y": {"aggregate":"count",
    "field":"_source.staff_id",
    "type": "quantitative"},
    
    "x": {"field": "_source.staff_name", "type": "ordinal"}
  }
}

or is there any other way to do this in kibana?

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