# Fuzzy query is returning all documents

**URL:** <https://discuss.elastic.co/t/fuzzy-query-is-returning-all-documents/68939>\
**Category:** Elasticsearch\
**Created:** [December 13, 2016, 8:52pm UTC](https://discuss.elastic.co/t/fuzzy-query-is-returning-all-documents/68939 "2016-12-13T20:52:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [December 13, 2016, 8:52pm UTC](https://discuss.elastic.co/t/fuzzy-query-is-returning-all-documents/68939/1 "2016-12-13T20:52:07Z")

</div>

No matter what keyword I pass in, I get all of my documents in the response. Even those not matching my search criteria.

Here is the PHP code:

```
$params = [
'index' => 'ats_search_engine',
		'body' => [
		'query' => [
			'fuzzy' => [
				'_all' => $keyword
					]
				]
			]
		];
		
		$response = $client->search ( $params );

```

Not sure why this is happening?

---

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [December 15, 2016, 5:06pm UTC](https://discuss.elastic.co/t/fuzzy-query-is-returning-all-documents/68939/2 "2016-12-15T17:06:37Z")

</div>

Seems the PHP array way of constructing the request is not working for me.  
I decided to try this, which worked:

```
	$json = '{
    "query" : {
        "match" : {
            "title" : "members"
        }
    }
}';
	
$params['index'] = 'ats_search_engine';
$params['type'] = 'thoracic';
$params['body'] = $json;

```

So, just to repeat, the array way of doing things is not working for me.

---

<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:** [January 12, 2017, 5:06pm UTC](https://discuss.elastic.co/t/fuzzy-query-is-returning-all-documents/68939/3 "2017-01-12T17:06:38Z")

</div>

Closed on January 12, 2017, 5:06pm UTC

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