# How to do partial matching on decimal numbers?

**URL:** <https://discuss.elastic.co/t/how-to-do-partial-matching-on-decimal-numbers/7685>\
**Category:** Elasticsearch\
**Created:** [May 14, 2012, 1:30pm UTC](https://discuss.elastic.co/t/how-to-do-partial-matching-on-decimal-numbers/7685 "2012-05-14T13:30:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shane\_Witbeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shane_witbeck/32/2803_2.png) [@Shane\_Witbeck](https://discuss.elastic.co/u/Shane_Witbeck)\
**Post date:** [May 14, 2012, 1:30pm UTC](https://discuss.elastic.co/t/how-to-do-partial-matching-on-decimal-numbers/7685/1 "2012-05-14T13:30:01Z")

</div>

I've run into an issue where search isn't returning a doc based on a  
partial decimal number.

Here's an example:

For a doc with content "P 11.7.67093 BS in longevity test"

searching for 11.7 does not return the doc but searching for 11.7.67093  
does.

Here's the search query: [https://gist.github.com/2693957](https://gist.github.com/2693957)

Here's the mapping: [https://gist.github.com/2693973](https://gist.github.com/2693973)

For the above example, the "P 11.7.67093 BS in longevity test" is in the  
"subject" of an indexed doc.

How would I have the document returned on searches for 11.7?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [May 14, 2012, 2:38pm UTC](https://discuss.elastic.co/t/how-to-do-partial-matching-on-decimal-numbers/7685/2 "2012-05-14T14:38:00Z")

</div>

The standard analyzer treats "11.7.67093" as a single token, which doesn't  
match "11.7", but you can use Prefix Query[http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/prefix-query.html)to find it.

You can also try switching to a different analyzer if you want 11.7.67093  
to be treated as 3 separate tokens. The Pattern Analyzer might be a good  
place to start.

On Monday, May 14, 2012 9:30:01 AM UTC-4, Shane Witbeck wrote:

> I've run into an issue where search isn't returning a doc based on a  
> partial decimal number.
> 
> Here's an example:
> 
> For a doc with content "P 11.7.67093 BS in longevity test"
> 
> searching for 11.7 does not return the doc but searching for 11.7.67093  
> does.
> 
> Here's the search query: [partial decimal number search · GitHub](https://gist.github.com/2693957)
> 
> Here's the mapping: [Thread mapping · GitHub](https://gist.github.com/2693973)
> 
> For the above example, the "P 11.7.67093 BS in longevity test" is in the  
> "subject" of an indexed doc.
> 
> How would I have the document returned on searches for 11.7?

---

<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, 3:28am UTC](https://discuss.elastic.co/t/how-to-do-partial-matching-on-decimal-numbers/7685/3 "2017-07-06T03:28:57Z")

</div>


