Programmers learn & share
0 votes

Problem :

I want to send a JSON to elasticSearch. I am trying using Postman and SOAPUI

The data  I am using is as follows:


[{"column1": "abc", "column2": "def", "column3": "dghi", "column4": "jkl", "column5": "mno"}, {"column1": "pqr", "column2": "stu", "column3": "vwx", "column4": "", "column5": ""}]

But I am getting the following error :


  "error": {

    "root_cause": [


        "type": "mapper_parsing_exception",

        "reason": "failed to parse"



    "type": "mapper_parsing_exception",

    "reason": "failed to parse",

    "caused_by": {

      "type": "not_x_content_exception",

      "reason": "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"



  "status": 400


But whenever I try to post a single JSON array as follows


{"column1": "abc", "column2": "def", "column3": "dghi", "column4": "jkl", "column5": "mno"}

Then it works fine. I am unable to understand that what is going wrong.

by (6.9k points)   | 483 views

1 Answer

0 votes

Solution :

I also had the same error while I was trying to post to elasticsearch but using node js. I utilized the node fetch package to make a PUT request to elasticsearch. It was weird as using the exact same thing on postman there was no error but was having the error on node js. I was initially doing as follows:


const current = {

    "id" : "123456789"


const options = {

    method: "POST",

    headers: {

        "Content-Type": "application/json"


    body: current


And I found that the error got fixed when I changed it as follows:


body: JSON.stringify(current)

by (36.1k points)  
2,245 questions
2,807 answers
241 users