# Fields containing only whitespace are assigned null values by EsInputFormat in a JSON document

**URL:** <https://discuss.elastic.co/t/fields-containing-only-whitespace-are-assigned-null-values-by-esinputformat-in-a-json-document/23137>\
**Category:** Elasticsearch\
**Created:** [April 7, 2015, 7:11pm UTC](https://discuss.elastic.co/t/fields-containing-only-whitespace-are-assigned-null-values-by-esinputformat-in-a-json-document/23137 "2015-04-07T19:11:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suchindra\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Suchindra\_Agarwal](https://discuss.elastic.co/u/Suchindra_Agarwal)\
**Post date:** [April 7, 2015, 7:11pm UTC](https://discuss.elastic.co/t/fields-containing-only-whitespace-are-assigned-null-values-by-esinputformat-in-a-json-document/23137/1 "2015-04-07T19:11:31Z")

</div>

I am using EsInputFormat on EC2 to query data from Elasticsearch.

Example document:

{  
"feature\_key": {  
"brand\_name": " ",  
"product\_type": "HOME",  
"language\_tag": "ja\_JP"  
},  
"stats": {  
"1\_count": 0,  
"2\_count": 1,  
"3\_count": 1,  
},  
}

The brand\_name field contains the IDEOGRAPHIC WHITESPACE character  
(whitespace in Japanese). I have disabled analyze on the feature\_key field  
and all its sub-fields. After I finished indexing all documents, if I query  
through the rest end point, the document gets returned as is.

But using the EsInputFormat to query the document returns null value in the  
brand\_name field.

{  
"feature\_key": {  
"brand\_name": null,  
"product\_type": "HOME",  
"language\_tag": "ja\_JP"  
},  
"stats": {  
"1\_count": 0,  
"2\_count": 1,  
"3\_count": 1,  
},  
}

How can change this behavior? I do not want the \_source/document to be  
modified in any way.

Thanks,  
Suchin

--  
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/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [April 8, 2015, 5:50am UTC](https://discuss.elastic.co/t/fields-containing-only-whitespace-are-assigned-null-values-by-esinputformat-in-a-json-document/23137/2 "2015-04-08T05:50:47Z")

</div>

Looks like a bug likely caused by the conversion to Hadoop Writable. Can you please raise an issue at Github (under  
es-hadoop)?

Thanks,

On 4/7/15 10:11 PM, Suchindra Agarwal wrote:

> I am using EsInputFormat on EC2 to query data from Elasticsearch.
> 
> Example document:
> 
> |  
> {  
> "feature\_key":{  
> "brand\_name":" ",  
> "product\_type":"HOME",  
> "language\_tag":"ja\_JP"  
> },  
> "stats":{  
> "1\_count":0,  
> "2\_count":1,  
> "3\_count":1,  
> },  
> }  
> |
> 
> The brand\_name field contains the IDEOGRAPHIC WHITESPACE character (whitespace in Japanese). I have disabled analyze  
> on the feature\_key field and all its sub-fields. After I finished indexing all documents, if I query through the rest  
> end point, the document gets returned as is.
> 
> But using the EsInputFormat to query the document returns null value in the brand\_name field.
> 
> |  
> {  
> "feature\_key":{  
> "brand\_name":null,  
> "product\_type":"HOME",  
> "language\_tag":"ja\_JP"  
> },  
> "stats":{  
> "1\_count":0,  
> "2\_count":1,  
> "3\_count":1,  
> },  
> }  
> |
> 
> How can change this behavior? I do not want the \_source/document to be modified in any way.
> 
> Thanks,  
> Suchin
> 
> --  
> 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) [mailto:elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/f30efa1e-4e75-4e59-9e4e-dba7c5982aed%40googlegroups.com?utm_medium=email&utm_source=footer).  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Costin

--  
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/5524C1B7.3090204%40gmail.com](https://groups.google.com/d/msgid/elasticsearch/5524C1B7.3090204%40gmail.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, 12:20am UTC](https://discuss.elastic.co/t/fields-containing-only-whitespace-are-assigned-null-values-by-esinputformat-in-a-json-document/23137/3 "2017-07-06T00:20:59Z")

</div>


