# Bug when reading if a field has no mapping (empty array by ex.)

**URL:** <https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [February 24, 2017, 11:59am UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393 "2017-02-24T11:59:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [February 24, 2017, 11:59am UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393/1 "2017-02-24T11:59:32Z")

</div>

A tricky bug (or I miss a setting maybe ..), with ES 2.4.4 and ES4Hadoop 2.4.4, let's create an index:

```
PUT /toto/events/1
{
   "toto": 1,
   "data": [],
   "name": "webapp_loaded"
}

```

This will generate the mapping:

```
{
  "toto" : {
    "mappings" : {
      "events" : {
        "properties" : {
          "name" : {
            "type" : "string"
          },
          "toto" : {
            "type" : "long"
          }
        }
      }
    }
  }
}

```

Note: field data has no mapping, because it's an empty array I guess. Now, let's query this with Spark:

```
scala> sc.esRDD("toto").first.toString
res22: String = (1,Map(toto -> 1))

```

Where is the name and data fields? It looks like the parser "ignore" fields after data.

It seems fixed with es4Hadoop 5.0.0

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [February 28, 2017, 10:39am UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393/2 "2017-02-28T10:39:05Z")

</div>

Is 2.4.4 stable or should I use 5.0.0 on production, even with an elasticsearch cluster version 2.4.4 ?

Thanks you,

---

<div class="post-metadata">

**Author:** ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)\
**Post date:** [March 11, 2017, 8:26pm UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393/3 "2017-03-11T20:26:07Z")

</div>

@ebuildy Linking your github issue about this here as well: [https://github.com/elastic/elasticsearch-hadoop/issues/946](https://github.com/elastic/elasticsearch-hadoop/issues/946)

To also repeat the outcome from the ticket: The issue here seems to be the fact that you're using just the index name and no type name. I'll add a configuration validation stage to make sure that types are set, but this may have to wait for an appropriate release since it is a contract change to acceptable values in a configuration.

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [March 12, 2017, 9:18pm UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393/4 "2017-03-12T21:18:27Z")

</div>

Yeah validation could save life 😉

Thanks you,

---

<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:** [April 9, 2017, 9:18pm UTC](https://discuss.elastic.co/t/bug-when-reading-if-a-field-has-no-mapping-empty-array-by-ex/76393/5 "2017-04-09T21:18:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
