# Need some help for fuzzysearch in es

**URL:** <https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136>\
**Category:** Elasticsearch\
**Created:** [September 9, 2016, 6:25am UTC](https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136 "2016-09-09T06:25:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Kruse\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefan_kruse_2/32/12005_2.png) [@Stefan\_Kruse\_2](https://discuss.elastic.co/u/Stefan_Kruse_2)\
**Post date:** [September 9, 2016, 6:25am UTC](https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136/1 "2016-09-09T06:25:25Z")

</div>

Hi, i would like to make a fuzzysearch with elasticsearch php client.

I try the follow code:

```
$params = [
	    'index' => 'bank',
	    'type' => 'account',
	    'size' => 1000,
	    'body' => [
	        'query' => [
	            'match' => [
	                'address' => [
	                	'query' => 'Avenue Bath',
	                	'fuzziness' => 'AUTO',
	                	'operator' => 'and'
	                ]
	            ]
	        ]
	    ]
	];

```

I got the right results where address has avenue and bath. But what is if i want results even i enter only some characters like ave and ba?

Do i need an analyzer for this or how can i make this work?

thanks for helping...

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [September 9, 2016, 9:29am UTC](https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136/2 "2016-09-09T09:29:49Z")

</div>

Hey,

I am not sure if you want to do a fuzzy search here. Fuzzy means, that there is a certain amount of changes allowed (with a maximum edit distance of 2). Your example looks rather like a prefix query. You might want to checkout the [match ohrase prefix query](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-match-query.html#query-dsl-match-query-phrase-prefix).

Another idea to take into account for similar searches would be a phonetic search, see the [Phonetic Matching docs](https://www.elastic.co/guide/en/elasticsearch/guide/2.x/phonetic-matching.html) in the definitive guide.

Hope this helps.

--Alex

---

<div class="post-metadata">

**Author:** ![Stefan\_Kruse\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stefan_kruse_2/32/12005_2.png) [@Stefan\_Kruse\_2](https://discuss.elastic.co/u/Stefan_Kruse_2)\
**Post date:** [September 16, 2016, 1:33pm UTC](https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136/3 "2016-09-16T13:33:31Z")

</div>

hi, i try this but i dont get it to work. i have a problem. if i enter the words "Avenue" and "Bath" everything is working fine , but if i change it to "Bath" and "Avenue" nothing is found, the same with phrase like "ba" and "ave". MAybe i need a ngram token filter or something like this? thanks

---

<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 5, 2017, 10:19pm UTC](https://discuss.elastic.co/t/need-some-help-for-fuzzysearch-in-es/60136/4 "2017-07-05T22:19:40Z")

</div>


