• Register
0 votes
1.6k views

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.

6 5 3
6,930 points

Please log in or register to answer this question.

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)

9 7 4
38,600 points

Related questions

0 votes
1 answer 2 views
2 views
Problem: How to I Solve this: the json object must be str, bytes or bytearray, not 'dict' HELP! I need help understanding this: the json object must be str, bytes or bytearray, not 'dict' Can someone please help solve this, I am new in python(). Someone have idea to solve this thanks!
asked 2 days ago Mashhoodch 11.4k points
0 votes
2 answers 635 views
635 views
Problem : I am new to Unity5. I am facing following error while trying to do setDestination. "SetDestination" can only be called on an active agent that has been placed on a NavMesh. UnityEngine.NavMeshAgent:SetDestination(Vector3) CompleteProject.EnemyMovement:Update() (at Assets/ ... ; } } } } May I know what is wrong with the above code? Does anyone have any solution on my issue?
asked Nov 27, 2019 alecxe 7.5k points
0 votes
1 answer 1.5K views
1.5K views
Problem : I am very new to Curl. I have recently started learning Curl. Whenever I try to connect to the Elasticsearch using below command curl http://localhost:9200 it is working properly. But when I try to run the following command curl http://IpAddress: ... showing me below error “Curl: (7) failed to connect to localhost port 9200: connection refused” How can I resolve above error?
asked Feb 20, 2020 mphil 2.3k points
0 votes
1 answer 238 views
238 views
Problem : I am facing an issue with a systemd config for ElasticSearch as follows: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
asked Nov 18, 2019 peterlaw 6.9k points
1 vote
1 answer 591 views
591 views
Problem : Getting following error related to content-type header {"error":"content-type header [application/x-www-form-urlencoded] is not supported","status":406} How to resolve it?
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 58 views
58 views
Problem: What feature on some network switches can be used to detect faked arp messages? A) DHCP snooping B) session monitoring C) dynamic packet inspection D) dynamic ARP inspection Can anyone help who know about network switches?
asked Feb 17, 2020 maddi86 5.4k points
0 votes
1 answer 58 views
58 views
Problem error: `fsevents` unavailable (this watcher can only be used on darwin)
asked Feb 9 charles mathews 3.9k points
0 votes
2 answers 50 views
50 views
Problems: Can anyone give the right solution? The OEM version of Windows 7 can only be installed on a new PC for resale? True or False
asked Feb 13, 2020 maddi86 5.4k points
0 votes
1 answer 33 views
33 views
Problem : I want to do below query INSERT INTO dbo.tbl_A_archive  SELECT * FROM SERVERxyz.DB.dbo.tbl_A However even after I ran below code set identity_insert dbo.tbl_A_archive on I am facing below error message “Can only be specified when a column list is used and IDENTITY_INSERT ... a huge number of columns. I can not type all of the columns out manually. How can I get this to be fixed?
asked Jan 29, 2020 jwilliam 3.9k points