# Any way to store JSON data without analyzing it

**URL:** <https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286>\
**Category:** Elasticsearch\
**Created:** [November 6, 2013, 10:17am UTC](https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286 "2013-11-06T10:17:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Schoen](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Matt\_Schoen](https://discuss.elastic.co/u/Matt_Schoen)\
**Post date:** [November 6, 2013, 10:17am UTC](https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286/1 "2013-11-06T10:17:32Z")

</div>

Hi there,

I started a topic earlier about making a mapping for a recursive tree  
structure to which there wasn't a great answer, but my original desire was  
to just turn off analysis on certain indexes. All that I'd like to do is  
store a JSON document by ID and recall it. In this case the need has again  
arisen because of the way I'm treating floating point numbers in my JSON  
parser. I designed it to support INFINITY and NaN, which I understand is  
not actually a part of the official JSON specification. The issue I have  
is that sometimes a float field is a number, and sometimes it's a string.  
For example, I have a field that can sometimes be = INFINITY. If I've  
mapped this field as a float, a document with it = INFINITY will come in  
with that field as a string. This throws an error:

MapperParsingException[failed to parse [max\_length]]; nested:  
NumberFormatException[For input string: "INFINITY"];

max\_length being the field name and INFINITY being the value I'm trying to  
set it to. As I said before I really just want to disable analysis and  
store the documents wholesale. Or maybe I can just mark certain fields as  
don't analyze? Any other ideas for what I should do here? The only thing  
I can think of is to escape the JSON and store it as a string, or to  
convert all my float parameters to and from strings when I store them.

Thanks for the help!

--  
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:** ![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:** [November 14, 2013, 10:07am UTC](https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286/2 "2013-11-14T10:07:09Z")

</div>

Hey,

you could achieve this, using mapping templates or simply ignore this kind  
of errors when indexing. There is a ignore\_malformed configuration setting  
for the mapping.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--Alex

On Wed, Nov 6, 2013 at 11:17 AM, Matt Schoen [mtschoen@gmail.com](mailto:mtschoen@gmail.com) wrote:

> Hi there,
> 
> I started a topic earlier about making a mapping for a recursive tree  
> structure to which there wasn't a great answer, but my original desire was  
> to just turn off analysis on certain indexes. All that I'd like to do is  
> store a JSON document by ID and recall it. In this case the need has again  
> arisen because of the way I'm treating floating point numbers in my JSON  
> parser. I designed it to support INFINITY and NaN, which I understand is  
> not actually a part of the official JSON specification. The issue I have  
> is that sometimes a float field is a number, and sometimes it's a string.  
> For example, I have a field that can sometimes be = INFINITY. If I've  
> mapped this field as a float, a document with it = INFINITY will come in  
> with that field as a string. This throws an error:
> 
> MapperParsingException[failed to parse [max\_length]]; nested:  
> NumberFormatException[For input string: "INFINITY"];
> 
> max\_length being the field name and INFINITY being the value I'm trying to  
> set it to. As I said before I really just want to disable analysis and  
> store the documents wholesale. Or maybe I can just mark certain fields as  
> don't analyze? Any other ideas for what I should do here? The only thing  
> I can think of is to escape the JSON and store it as a string, or to  
> convert all my float parameters to and from strings when I store them.
> 
> Thanks for the help!
> 
> --  
> 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:** ![Matt\_Schoen](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Matt\_Schoen](https://discuss.elastic.co/u/Matt_Schoen)\
**Post date:** [November 21, 2013, 4:02am UTC](https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286/3 "2013-11-21T04:02:16Z")

</div>

Hey Alex. Your advice led me down the right path. The enabled property was  
ultimately my friend.

My mapping now has  
{ ...

"properties"{

"data":{"type":"object", "enabled":false}

}

}

and everything is happy! Hallelujah! It would be nice for this to be a  
little clearer in the documentation. It seems that this would be a very  
common need and the enabled flag is kind of buried. Enabled is mentioned  
in the first paragraph but its function isn't clear until later. Anyway  
now I know so I'm all set, but I wonder if we could make this process  
easier for noobs.

On Thursday, November 14, 2013 3:07:09 AM UTC-7, Alexander Reelsen wrote:

> Hey,
> 
> you could achieve this, using mapping templates or simply ignore this kind  
> of errors when indexing. There is a ignore\_malformed configuration setting  
> for the mapping.
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html)
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-templates.html)
> 
> --Alex
> 
> On Wed, Nov 6, 2013 at 11:17 AM, Matt Schoen \<[mtsc...@gmail.com](mailto:mtsc...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Hi there,
> > 
> > I started a topic earlier about making a mapping for a recursive tree  
> > structure to which there wasn't a great answer, but my original desire was  
> > to just turn off analysis on certain indexes. All that I'd like to do is  
> > store a JSON document by ID and recall it. In this case the need has again  
> > arisen because of the way I'm treating floating point numbers in my JSON  
> > parser. I designed it to support INFINITY and NaN, which I understand is  
> > not actually a part of the official JSON specification. The issue I have  
> > is that sometimes a float field is a number, and sometimes it's a string.  
> > For example, I have a field that can sometimes be = INFINITY. If I've  
> > mapped this field as a float, a document with it = INFINITY will come in  
> > with that field as a string. This throws an error:
> > 
> > MapperParsingException[failed to parse [max\_length]]; nested:  
> > NumberFormatException[For input string: "INFINITY"];
> > 
> > max\_length being the field name and INFINITY being the value I'm trying  
> > to set it to. As I said before I really just want to disable analysis and  
> > store the documents wholesale. Or maybe I can just mark certain fields as  
> > don't analyze? Any other ideas for what I should do here? The only thing  
> > I can think of is to escape the JSON and store it as a string, or to  
> > convert all my float parameters to and from strings when I store them.
> > 
> > Thanks for the help!
> > 
> > --  
> > 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:** ![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:05am UTC](https://discuss.elastic.co/t/any-way-to-store-json-data-without-analyzing-it/14286/4 "2017-07-06T02:05:48Z")

</div>


