# Need parameter based query Kibana Dashboard

**URL:** <https://discuss.elastic.co/t/need-parameter-based-query-kibana-dashboard/355687>\
**Category:** Kibana\
**Tags:** elastic-stack-security\
**Created:** [March 19, 2024, 7:59am UTC](https://discuss.elastic.co/t/need-parameter-based-query-kibana-dashboard/355687 "2024-03-19T07:59:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tqvenkata](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tqvenkata](https://discuss.elastic.co/u/Tqvenkata)\
**Post date:** [March 19, 2024, 7:59am UTC](https://discuss.elastic.co/t/need-parameter-based-query-kibana-dashboard/355687/1 "2024-03-19T07:59:41Z")

</div>

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" : {

```auto
    "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](mailto:jane.doe@example.com)",  
"first\_name": "rajesh",  
"table": "employee"  
}

PUT /testindextest2/\_doc/2  
{  
"userid": {  
"user\_id": [245]  
},  
"email": "[satish@example.com](mailto: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

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [March 19, 2024, 9:53am UTC](https://discuss.elastic.co/t/need-parameter-based-query-kibana-dashboard/355687/2 "2024-03-19T09:53:47Z")

</div>

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](https://www.elastic.co/blog/how-to-embed-kibana-dashboards).

Hope that helps!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 16, 2024, 9:54am UTC](https://discuss.elastic.co/t/need-parameter-based-query-kibana-dashboard/355687/3 "2024-04-16T09:54:06Z")

</div>

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