I want to achieve conditional query in elastic search as described

/*
I want to achieve this kind of conditional query in ElasticSearch using PHP client library, 
I want to execute the match clause(In ElasticSearch) only if the the value is set or if there is some value
*/
$sql="select * from tab_client_details where 1";
      if($data['bill']) $sql .= " and txt_bill_no='".$data['bill']."'";
      if($data['empid']) $sql .= " and int_employee_id='".$data['empid']."'";
      if($data['start_date']) $sql .= " and dt_date>='".$data['start_date']."'";
      if($data['end_date']) $sql .= " and dt_date<='".$data['end_date']."'";
      if($data['token']) $sql .= " and token in ('ABXPO1', 'ARTUI2', 'PQHCUD8')";

This is the first time I am creating a topic, I am kind of stucked here, it would be great if anyone can help, i tried nested query using must inside should, but couldn't get the desired result.

Regards.

Think what would work for you is using a search template with parameters.

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html