How to acheive multiple filter in elastic search using API

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

@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

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