# Fuzzy search with space

**URL:** https://discuss.elastic.co/t/fuzzy-search-with-space/31685
**Category:** Elasticsearch
**Created:** [October 6, 2015, 10:20am UTC](https://discuss.elastic.co/t/fuzzy-search-with-space/31685 "2015-10-06T10:20:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)
#### Post date: [October 6, 2015, 10:20am UTC](https://discuss.elastic.co/t/fuzzy-search-with-space/31685/1 "2015-10-06T10:20:51Z")

</div>

How can i search with space  
my query:  
$params = [  
'index' =\> 'port',  
'type' =\> 'contact',  
'size' =\> 50,  
'body' =\> [  
'query' =\> [  
'fuzzy' =\> [  
'full\_name' =\> [  
'value' =\> $value,  
"boost" =\> 1.0,  
"fuzziness" =\> 1,  
"prefix\_length" =\> 0,  
"max\_expansions" =\> 100,  
'operator' =\> 'and'  
]  
]  
]  
]  
];

---

<div class="post-metadata">

### Author: ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)
#### Post date: [October 6, 2015, 6:43pm UTC](https://discuss.elastic.co/t/fuzzy-search-with-space/31685/2 "2015-10-06T18:43:20Z")

</div>

You need to [control analysis](http://opensourceconnections.com/blog/2015/09/18/the-simple-power-of-elasticsearch-analyzers/), either at query time or index time, to not tokenize on spaces. Lucene-based search is token first. Fuzzy queries generate wildcard and term queries to search that leverage the underlying term-base index.

---

<div class="post-metadata">

### Author: ![kodermax](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kodermax](https://discuss.elastic.co/u/kodermax)
#### Post date: [October 6, 2015, 6:56pm UTC](https://discuss.elastic.co/t/fuzzy-search-with-space/31685/3 "2015-10-06T18:56:48Z")

</div>

I use this variant.  
$params = [  
'index' =\> 'portal',  
'type' =\> 'contact',  
'size' =\> 50,  
'body' =\> [  
'query' =\> [  
'match' =\> [  
'full\_name' =\> [  
'query' =\> $value,  
'operator' =\> 'and',  
'fuzziness' =\> 1  
]  
]  
]  
]  
];

It's ok?

---

<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, 11:46pm UTC](https://discuss.elastic.co/t/fuzzy-search-with-space/31685/4 "2017-07-05T23:46:26Z")

</div>


