Need parameter based query Kibana Dashboard

Hi,
I want to create dashboard to view the data based on USERID as parameter from application

Please find the Sample Mapping

put /testindextest2
{
"mappings" : {
"properties" : {

    "first_name" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
    
    "table" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 256
        }
      }
    },
            "userid" : {
      "type" : "nested",
      "properties" : {
        "user_id" : {
          "type" : "integer"
        }
      }
    }
  }
}

}

PUT /testindextest2/_doc/1
{
"userid": {
"user_id": [123, 456,910]
},
"email": "jane.doe@example.com",
"first_name": "rajesh",
"table": "employee"
}

PUT /testindextest2/_doc/2
{
"userid": {
"user_id": [245]
},
"email": "satish@example.com",
"first_name": "satish",
"table": "employee"
}

PUT /testindextest2/_doc/3
{
"userid": {
"user_id": [789, 910]
},
"table": "users"
}

PUT /testindextest2/_doc/4
{
"userid": {
"user_id": [123]
},
"first_name": "testuser",
"table": "users"
}

PUT /testindextest2/_doc/5
{
"userid": {
"user_id": [245]
},
"first_name": "testuser2",
"table": "users"
}

I used Below query to get Matchid userid123 from both employee,users table.

GET /testindextest2/_search
{
"query": {
"bool": {
"filter": [
{
"nested": {
"path": "userid",
"query": {
"terms": {
"userid.user_id": [123]
}
}
}
},
{
"bool": {
"should": [
{ "term": { "table.keyword": "employee" } },
{ "term": { "table.keyword": "users" } }
]
}
}
]
}
}
}

Now from Kibana ,how can i use above get result query with parameter user_id as dynamic based on userlogin (iframe code url) .So user can see his data only based on userid

Hi @Tqvenkata,

Since you mention the iframe URL I assume you are embedding your dashboard in a web application. In the Kibana embedded URL there are two filter parameters _g and _a that are used to pass state.

In your case I believe you'll want to pass the user_id to _a similar to the airline in the custom controls section of this blog.

Hope that helps!

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