# Search for name(text) with spaces

**URL:** <https://discuss.elastic.co/t/search-for-name-text-with-spaces/12088>\
**Category:** Elasticsearch\
**Created:** [May 23, 2013, 8:11am UTC](https://discuss.elastic.co/t/search-for-name-text-with-spaces/12088 "2013-05-23T08:11:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maaz\_Bin\_Tariq](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Maaz\_Bin\_Tariq](https://discuss.elastic.co/u/Maaz_Bin_Tariq)\
**Post date:** [May 23, 2013, 8:11am UTC](https://discuss.elastic.co/t/search-for-name-text-with-spaces/12088/1 "2013-05-23T08:11:04Z")

</div>

Hi,

Searching for names(text) with spaces in it, causing problem to me,  
I have mapping similar to  
"{"user":{"properties":{"name":{"type":"string"}}}}"

Ideally what it should return and rank results as follows

1. Bring on top names that exact match the search term (highest score)
2. Names that starts with the search term (high score)
3. Names that contains the exact search term as substring (medium score)
4. Names that contains any of the search term token (lowest score)

\*Example \*  
For following names in elasticsearch  
Maaz Tariq  
Ahmed Maaz Tariq  
Maaz Sheeba  
Maaz Bin Tariq  
Sana Tariq  
Maaz Tariq Ahmed

Searching for "Maaz Tariq" , Results should be in following order  
Maaz Tariq (highest score)  
Maaz Tariq Ahmed (high score)  
Ahmed Maaz Tariq (medium score)  
Maaz Bin Tariq (lowest score)  
Maaz Sheeba (lowest score)  
Sana Tariq (lowest score)

Can any one point me how and which analyzers to use? and how to rank the  
search results for names?

Thanks  
-Maaz

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Maaz\_Bin\_Tariq](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@Maaz\_Bin\_Tariq](https://discuss.elastic.co/u/Maaz_Bin_Tariq)\
**Post date:** [May 24, 2013, 4:56am UTC](https://discuss.elastic.co/t/search-for-name-text-with-spaces/12088/2 "2013-05-24T04:56:20Z")

</div>

Guys any input on it?

On Thursday, May 23, 2013 1:11:04 PM UTC+5, Maaz Bin Tariq wrote:

> Hi,
> 
> Searching for names(text) with spaces in it, causing problem to me,  
> I have mapping similar to  
> "{"user":{"properties":{"name":{"type":"string"}}}}"
> 
> Ideally what it should return and rank results as follows
> 
> 1. Bring on top names that exact match the search term (highest score)
> 2. Names that starts with the search term (high score)
> 3. Names that contains the exact search term as substring (medium score)
> 4. Names that contains any of the search term token (lowest score)
> 
> \*Example \*  
> For following names in elasticsearch  
> Maaz Tariq  
> Ahmed Maaz Tariq  
> Maaz Sheeba  
> Maaz Bin Tariq  
> Sana Tariq  
> Maaz Tariq Ahmed
> 
> Searching for "Maaz Tariq" , Results should be in following order  
> Maaz Tariq (highest score)  
> Maaz Tariq Ahmed (high score)  
> Ahmed Maaz Tariq (medium score)  
> Maaz Bin Tariq (lowest score)  
> Maaz Sheeba (lowest score)  
> Sana Tariq (lowest score)
> 
> Can any one point me how and which analyzers to use? and how to rank the  
> search results for names?
> 
> Thanks  
> -Maaz

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:34am UTC](https://discuss.elastic.co/t/search-for-name-text-with-spaces/12088/3 "2017-07-06T02:34:58Z")

</div>


