# Filtering in PHP elasticsearch

**URL:** <https://discuss.elastic.co/t/filtering-in-php-elasticsearch/21771>\
**Category:** Elasticsearch\
**Created:** [January 22, 2015, 9:33am UTC](https://discuss.elastic.co/t/filtering-in-php-elasticsearch/21771 "2015-01-22T09:33:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![publichealthapp](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@publichealthapp](https://discuss.elastic.co/u/publichealthapp)\
**Post date:** [January 22, 2015, 9:33am UTC](https://discuss.elastic.co/t/filtering-in-php-elasticsearch/21771/1 "2015-01-22T09:33:44Z")

</div>

Hi all, i'm working with elasticsearch PHP client and performed basic  
search operation. Now i want to perform filter operation in search results.  
The code is below

$params = array();  
$params['index'] = "programs";  
$params['type'] = 'program';  
$query['match']['\_all'] = $\_POST['name'];  
$filter['term']['tags'] = "sports";  
$params['body']['query']['filtered'] = array(  
'query' =\> $query,  
'filter' =\> $filter  
);  
$results = $client-\>search($params);

The tags field contains (sports,health etc in comma separated) but it  
returns nothing. I want to filter search result with like operation.How can  
perform this?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/97a8da72-e0d7-4e68-8292-36a186aef162%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/97a8da72-e0d7-4e68-8292-36a186aef162%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 12:37am UTC](https://discuss.elastic.co/t/filtering-in-php-elasticsearch/21771/2 "2017-07-06T00:37:16Z")

</div>


