7

What i need

Here im trying

   PUT /customer/_doc/1?pretty
  {
   "name": "John Doe"
  }

Error request body is required

snapshot when i try to run url

1.http://localhost:9200/customer?pretty

enter image description here 2.http://localhost:9200/customer/_doc/1?pretty&pretty enter image description here

3.http://localhost:9200/customer/_doc/1?pretty&pretty&name=test enter image description here

can anyone suggest how to Insert document in Elastic search.

  • any suggestion is most welcome.
3
  • What do you have in the Body request tab? Commented Feb 20, 2018 at 14:00
  • can you please tell how can in insert document through postman. Commented Feb 20, 2018 at 14:02
  • You need to insert the JSON document inside the request Body and make sure to specify the Content-Type request header with the application/json value. Commented Feb 20, 2018 at 14:03

2 Answers 2

4

Pass the Json in body and change the URL as shown below:

Put into elastic via postman

Sign up to request clarification or add additional context in comments.

Comments

3

Use the PUT method for the same.

The url would be "http://localhost:9200/movies/"

movies is the name of the index.

The json to post is :

{
"id" : 1,
"title" : "Toy Story 1",
"year" : 1995,
"category" : "Adventure"
}

Here is the screenshot of the postman pushing the data to elasticseach :

Postman1

You can verify the data as below :

Use the GET method and the url as http://localhost:9200/movies/_search?

Postman2

3 Comments

Question please, How to insert more(>10000) documents?
@L.Kvri, you can write a scheduler or batch job for processing this.
How can I do that in postman? I dried to use /_bulk, but it not clear for me how to parametrize it in the body

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.