# Analyzer setting for non-string fields

**URL:** <https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828>\
**Category:** Elasticsearch\
**Created:** [October 2, 2013, 4:30pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828 "2013-10-02T16:30:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hugh\_Williams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugh_williams/32/2077_2.png) [@Hugh\_Williams](https://discuss.elastic.co/u/Hugh_Williams)\
**Post date:** [October 2, 2013, 4:30pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/1 "2013-10-02T16:30:06Z")

</div>

I have a number of numeric, date, and boolean fields in my index. I'm  
considering a mapping for them that specifies "index": "not\_analyzed".

Is there any reason I'd want to analyze document fields that are supposed  
to contain numerics, booleans, dates, etc?

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 2, 2013, 4:40pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/2 "2013-10-02T16:40:49Z")

</div>

The analysis settings have no relevance in non-text fields. If you look at  
all the subclasses of AbstractFieldMapper, you will notice that only  
StringFieldMapper, AFAIK, uses the analysis settings (besides the "no"  
setting of course).

Cheers,

Ivan

On Wed, Oct 2, 2013 at 9:30 AM, Hugh Williams [hughbiquitous@gmail.com](mailto:hughbiquitous@gmail.com)wrote:

> I have a number of numeric, date, and boolean fields in my index. I'm  
> considering a mapping for them that specifies "index": "not\_analyzed".
> 
> Is there any reason I'd want to analyze document fields that are supposed  
> to contain numerics, booleans, dates, etc?
> 
> --  
> 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).

--  
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:** ![Hugh\_Williams](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hugh_williams/32/2077_2.png) [@Hugh\_Williams](https://discuss.elastic.co/u/Hugh_Williams)\
**Post date:** [October 2, 2013, 4:43pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/3 "2013-10-02T16:43:08Z")

</div>

Thanks Ivan. So is there any reason to specify "index":"not\_analyzed" for  
those field types?

On Wednesday, October 2, 2013 12:40:49 PM UTC-4, Ivan Brusic wrote:

> The analysis settings have no relevance in non-text fields. If you look at  
> all the subclasses of AbstractFieldMapper, you will notice that only  
> StringFieldMapper, AFAIK, uses the analysis settings (besides the "no"  
> setting of course).
> 
> Cheers,
> 
> Ivan
> 
> On Wed, Oct 2, 2013 at 9:30 AM, Hugh Williams \<[hughbi...@gmail.com](mailto:hughbi...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I have a number of numeric, date, and boolean fields in my index. I'm  
> > considering a mapping for them that specifies "index": "not\_analyzed".
> > 
> > Is there any reason I'd want to analyze document fields that are supposed  
> > to contain numerics, booleans, dates, etc?
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [October 2, 2013, 5:50pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/4 "2013-10-02T17:50:34Z")

</div>

Correct, there is no reason to set the field as non\_analyzed since it is  
indexed and not tokenized by default.

As I was looking at the code myself, I noticed that the boolean field is  
tokenized by default. I was about to submit an issue, but I noticed I has  
been fixed already (I am on version 0.90.2).

Cheers,

Ivan.

On Wed, Oct 2, 2013 at 9:43 AM, Hugh Williams [hughbiquitous@gmail.com](mailto:hughbiquitous@gmail.com)wrote:

> Thanks Ivan. So is there any reason to specify "index":"not\_analyzed" for  
> those field types?
> 
> On Wednesday, October 2, 2013 12:40:49 PM UTC-4, Ivan Brusic wrote:
> 
> > The analysis settings have no relevance in non-text fields. If you look  
> > at all the subclasses of AbstractFieldMapper, you will notice that only  
> > StringFieldMapper, AFAIK, uses the analysis settings (besides the "no"  
> > setting of course).
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > On Wed, Oct 2, 2013 at 9:30 AM, Hugh Williams [hughbi...@gmail.com](mailto:hughbi...@gmail.com)wrote:
> > 
> > > I have a number of numeric, date, and boolean fields in my index. I'm  
> > > considering a mapping for them that specifies "index": "not\_analyzed".
> > > 
> > > Is there any reason I'd want to analyze document fields that are  
> > > supposed to contain numerics, booleans, dates, etc?
> > > 
> > > --  
> > > 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 elasticsearc...@\*\*[googlegroups.com](http://googlegroups.com).
> > > 
> > > For more options, visit [https://groups.google.com/\*\*groups/opt\_out](https://groups.google.com/**groups/opt_out)[https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out)  
> > > .
> > 
> > --  
> > 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).

--  
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:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [December 11, 2013, 11:22pm UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/5 "2013-12-11T23:22:27Z")

</div>

Hi Ivan - A follow up question on this is how one should then search for  
numbers: say if we search for 100.0 and 100, it should both yield same  
result.

thoughts?

-Amit.

On Wed, Oct 2, 2013 at 10:50 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Correct, there is no reason to set the field as non\_analyzed since it is  
> indexed and not tokenized by default.
> 
> As I was looking at the code myself, I noticed that the boolean field is  
> tokenized by default. I was about to submit an issue, but I noticed I has  
> been fixed already (I am on version 0.90.2).
> 
> Cheers,
> 
> Ivan.
> 
> On Wed, Oct 2, 2013 at 9:43 AM, Hugh Williams [hughbiquitous@gmail.com](mailto:hughbiquitous@gmail.com)wrote:
> 
> > Thanks Ivan. So is there any reason to specify "index":"not\_analyzed" for  
> > those field types?
> > 
> > On Wednesday, October 2, 2013 12:40:49 PM UTC-4, Ivan Brusic wrote:
> > 
> > > The analysis settings have no relevance in non-text fields. If you look  
> > > at all the subclasses of AbstractFieldMapper, you will notice that only  
> > > StringFieldMapper, AFAIK, uses the analysis settings (besides the "no"  
> > > setting of course).
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > On Wed, Oct 2, 2013 at 9:30 AM, Hugh Williams [hughbi...@gmail.com](mailto:hughbi...@gmail.com)wrote:
> > > 
> > > > I have a number of numeric, date, and boolean fields in my index. I'm  
> > > > considering a mapping for them that specifies "index": "not\_analyzed".
> > > > 
> > > > Is there any reason I'd want to analyze document fields that are  
> > > > supposed to contain numerics, booleans, dates, etc?
> > > > 
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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).
> 
> --  
> 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).

--  
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/CAAOGaQ%2BVp1uXrE%2Bgc4tv5xOG9ap06qXo0HXe4Bt7hnCn9wT48w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2BVp1uXrE%2Bgc4tv5xOG9ap06qXo0HXe4Bt7hnCn9wT48w%40mail.gmail.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:01am UTC](https://discuss.elastic.co/t/analyzer-setting-for-non-string-fields/13828/6 "2017-07-06T02:01:51Z")

</div>


