# How to acheive multiple filter in elastic search using API

**URL:** https://discuss.elastic.co/t/how-to-acheive-multiple-filter-in-elastic-search-using-api/315131
**Category:** Kibana
**Created:** [September 26, 2022, 6:45am UTC](https://discuss.elastic.co/t/how-to-acheive-multiple-filter-in-elastic-search-using-api/315131 "2022-09-26T06:45:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Azhar\_Uddin1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/azhar_uddin1/32/98900_2.png) [@Azhar\_Uddin1](https://discuss.elastic.co/u/Azhar_Uddin1)
#### Post date: [September 26, 2022, 6:45am UTC](https://discuss.elastic.co/t/how-to-acheive-multiple-filter-in-elastic-search-using-api/315131/1 "2022-09-26T06:45:29Z")

</div>

How could I be able to add multiple filters on my `index` like in an image  
I have filtered that result by `first_name` and then by `category` using `elasticsearch client`

```auto
@app.route('/get-data')
@login_required
def get_permission():
    uri = f'https://localhost:9200/'
    client = Elasticsearch(hosts=uri, basic_auth=(session['username'], session['password']), ca_certs=session['cert'], verify_certs=False)
    
    body = {
            "from" : 0,
            "size" : 20,
            "query" : {
                "bool" : {
                    "must" : [],
                    "filter" : [],
                    "must_not":[],
                    "should" :[],
                }
            }
        }

    index_data = client.search(index=index, body=body)
    return render_template('showdata.html', index_data=index_data)

```

using the above code I am able to filter the data once but couldn't able to implement multiple filters we were able to do it in `kibana` dashboard

Is there a way to add another query without messing up with an old query like this  
or any method inside the `elastic client` so that a new filter can apply to the filtered data

 ![Screenshot 2022-09-26 at 12.02.47 PM](https://us1.discourse-cdn.com/elastic/original/3X/8/2/82bf6b9c4ec9ab1287301a89821f6d8ce200773e.png)

---

<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: [October 24, 2022, 6:46am UTC](https://discuss.elastic.co/t/how-to-acheive-multiple-filter-in-elastic-search-using-api/315131/2 "2022-10-24T06:46:22Z")

</div>

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