# Elasticsearch on nested datatype : MapperParsingException

**URL:** https://discuss.elastic.co/t/elasticsearch-on-nested-datatype-mapperparsingexception/113744
**Category:** Elasticsearch
**Created:** [January 2, 2018, 8:51am UTC](https://discuss.elastic.co/t/elasticsearch-on-nested-datatype-mapperparsingexception/113744 "2018-01-02T08:51:39Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Saurab\_Dahal](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@Saurab\_Dahal](https://discuss.elastic.co/u/Saurab_Dahal)
#### Post date: [January 2, 2018, 8:51am UTC](https://discuss.elastic.co/t/elasticsearch-on-nested-datatype-mapperparsingexception/113744/1 "2018-01-02T08:51:39Z")

</div>

this is my mapping

```
   {
  "mappings": {
    "data_test": {
      "properties": {
        "type": {
          "type": "keyword"
        },
        "geometry": {
          "type": "geo_point"
        },
        "proper": {
          "type":"nested",
          "properties": {
            "gid": {
              "type": "keyword"
            },
            "objectid": {
              "type": "keyword"
            },
            "nombre_del": {
              "type": "keyword"
            },
            "tipo_de_si": {
              "type": "double"
            },
            "codigo_de_": {
              "type": "double"
            }
          }
        }
      }
    }
  }
}

```

as per [this link](https://www.endpoint.com/blog/2013/04/30/elasticsearch-object-mapping-eof-400) anyfield with nested key:value pair will be treated as object and we need to provide an object to index the document. I have a data that looks like this (a sample)

```
"type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -74.0743290075,
          4.64168349373
        ]
      },
      "properties": {
        "gid": 14,
        "objectid": "986",
        "nombre_del": "Banco Popular",
        "tipo_de_si": "15",
        "codigo_de_": "13"
      }
    }

```

]

and my java code to index this data

> ```
> for (Object s : jar){
> JSONObject proper = new JSONObject(new JSONObject(s.toString()).get("properties").toString());
> System.out.println(proper); /// this prints
> 
> ```
> 
> > {"gid":353,"nombre\_del":"Banco Colpatria Red Multibanca","tipo\_de\_si":"15","codigo\_de\_":"15","objectid":"10835"}
> 
> ```
> bulkRequest.add(client.prepareIndex("geo_data_test", "data_test")
> .setSource(jsonBuilder()
> .startObject()
> .field("type",new JSONObject(s.toString()).get("type"))
> .field("geometry",new JSONObject(new JSONObject(s.toString()).get("geometry").toString()).get("coordinates"))
> .field("proper",proper)
> .endObject()
> )
> );
> }
> 
> BulkResponse r = bulkRequest.get();
> Consumer<BulkItemResponse> c = (s) -> System.out.println(s.getFailureMessage());
> r.forEach(c);
> client.close();
> 
> ```

if I run this I get  
`MapperParsingException[object mapping for [proper] tried to parse field [proper] as object, but found a concrete value]`  
but the `proper` variable is an object, so should it not be indexed ? or I am understanding wrong ?

---

<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: [January 30, 2018, 8:52am UTC](https://discuss.elastic.co/t/elasticsearch-on-nested-datatype-mapperparsingexception/113744/2 "2018-01-30T08:52:02Z")

</div>

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