# How to solve this error

**URL:** <https://discuss.elastic.co/t/how-to-solve-this-error/181624>\
**Category:** Elasticsearch\
**Created:** [May 17, 2019, 4:25pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624 "2019-05-17T16:25:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aman\_khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aman_khan/32/46402_2.png) [@aman\_khan](https://discuss.elastic.co/u/aman_khan)\
**Post date:** [May 17, 2019, 4:25pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/1 "2019-05-17T16:25:48Z")

</div>

#### 

method [POST], host [[http://localhost:9200](http://localhost:9200)], URI [/euronews/mytable/1266?pretty=true], status line [HTTP/1.1 400 Bad Request]  
{  
"error" : {  
"root\_cause" : [  
{  
"type" : "mapper\_parsing\_exception",  
"reason" : "failed to parse"  
}  
],  
"type" : "mapper\_parsing\_exception",  
"reason" : "failed to parse",  
"caused\_by" : {  
"type" : "json\_parse\_exception",  
"reason" : "Unexpected character ('f' (code 102)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@77d3355e; line: 2, column: 45]"  
}  
},  
"status" : 400  
}

###

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [May 17, 2019, 6:27pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/2 "2019-05-17T18:27:42Z")

</div>

Can you show the body of the mapping?

---

<div class="post-metadata">

**Author:** ![aman\_khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aman_khan/32/46402_2.png) [@aman\_khan](https://discuss.elastic.co/u/aman_khan)\
**Post date:** [May 17, 2019, 6:52pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/3 "2019-05-17T18:52:04Z")

</div>

### 

{  
"euronews": {  
"aliases": {},  
"mappings": {  
"mytable": {  
"properties": {  
"body": {  
"type": "text",  
"analyzer": "std\_english"  
},  
"lineNo": {  
"type": "long"  
}  
}  
}  
}

###

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [May 17, 2019, 8:30pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/4 "2019-05-17T20:30:01Z")

</div>

You don't need to provide the index name in the body, and you've got a few extra close braces in there as well. Try this:

```
PUT euronews
{
  "aliases": {
  }, 
  "mappings": {
    "mytable": {
      "properties": {
        "body": {
          "type": "text",
          "analyzer": "std_english"
        },
        "lineNo": {
          "type": "long"
        }
      }
    }
  }
}

```

I had to change the analyser to `english` but that created the index on my machine.

Hope this helps.

---

<div class="post-metadata">

**Author:** ![aman\_khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aman_khan/32/46402_2.png) [@aman\_khan](https://discuss.elastic.co/u/aman_khan)\
**Post date:** [May 17, 2019, 8:59pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/5 "2019-05-17T20:59:49Z")

</div>

what about this error:

### 

{  
"error" : {  
"root\_cause" : [  
{  
"type" : "mapper\_parsing\_exception",  
"reason" : "failed to parse"  
}  
],  
"type" : "mapper\_parsing\_exception",  
"reason" : "failed to parse",  
"caused\_by" : {  
"type" : "json\_parse\_exception",  
"reason" : "Unexpected character ('t' (code 116)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@69c6b504; line: 2, column: 15]"  
}  
},  
"status" : 400  
}

###

---

<div class="post-metadata">

**Author:** ![whatgeorgemade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/whatgeorgemade/32/103246_2.png) [@whatgeorgemade](https://discuss.elastic.co/u/whatgeorgemade)\
**Post date:** [May 17, 2019, 9:05pm UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/6 "2019-05-17T21:05:24Z")

</div>

Are you indexing a document or creating a mapping? In the first post, the URL looks like you're indexing a document but the error made me think you're creating a mapping using the wrong API.

If you're indexing, can you show the body of the document you're trying to index? There's likely a problem in the body of the request.

---

<div class="post-metadata">

**Author:** ![aman\_khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aman_khan/32/46402_2.png) [@aman\_khan](https://discuss.elastic.co/u/aman_khan)\
**Post date:** [May 19, 2019, 11:23am UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/7 "2019-05-19T11:23:02Z")

</div>

i am trying to enter data into my index using a program in java but it fails due to presence of "" and ' in body part of my data.the id part is ok. so could you help me with some code to insert data to my index in python or java

---

<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:** [June 16, 2019, 11:23am UTC](https://discuss.elastic.co/t/how-to-solve-this-error/181624/8 "2019-06-16T11:23:05Z")

</div>

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