# Prefix search on integer field

**URL:** <https://discuss.elastic.co/t/prefix-search-on-integer-field/17902>\
**Category:** Elasticsearch\
**Created:** [June 4, 2014, 9:13am UTC](https://discuss.elastic.co/t/prefix-search-on-integer-field/17902 "2014-06-04T09:13:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Cast\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simon_cast_2/32/1514_2.png) [@Simon\_Cast\_2](https://discuss.elastic.co/u/Simon_Cast_2)\
**Post date:** [June 4, 2014, 9:13am UTC](https://discuss.elastic.co/t/prefix-search-on-integer-field/17902/1 "2014-06-04T09:13:23Z")

</div>

Hi,

I'm trying to use a prefix search on an integer field that is stored and  
not analysed. From the documentation I would have expected that sending 1  
would return all numbers starting with 1 but that doesn't seem to be the  
case.

Does the prefix search work on integer fields?

Regards,

Simon

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [June 16, 2014, 12:07pm UTC](https://discuss.elastic.co/t/prefix-search-on-integer-field/17902/2 "2014-06-16T12:07:36Z")

</div>

Hey,

not sure here, whats your expectation of the data being returned? If you  
search for "1", should "1", "10", "111" be returned (otherwise a range  
query would make more sense)? If so, it might make more sense to have an  
additional multi field as a not\_analyzed string and use that one for these  
kind of queries...

--Alex

On Wed, Jun 4, 2014 at 11:13 AM, Simon Cast [simon@prodpad.com](mailto:simon@prodpad.com) wrote:

> Hi,
> 
> I'm trying to use a prefix search on an integer field that is stored and  
> not analysed. From the documentation I would have expected that sending 1  
> would return all numbers starting with 1 but that doesn't seem to be the  
> case.
> 
> Does the prefix search work on integer fields?
> 
> Regards,
> 
> Simon
> 
> --  
> 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).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/110f1887-c6e0-4f77-9ece-689f0a42b306%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM\_uDVczuDkiBHD9ZZgx9iR7TQKRGWZZu1%2B73TQhg4kgNg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM_uDVczuDkiBHD9ZZgx9iR7TQKRGWZZu1%2B73TQhg4kgNg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:22am UTC](https://discuss.elastic.co/t/prefix-search-on-integer-field/17902/3 "2017-07-06T01:22:13Z")

</div>


