afeef
afeef

Reputation: 4716

how to use Postman to Insert Document in Elastic Search

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.

Upvotes: 7

Views: 26552

Answers (2)

Abhijit Bashetti
Abhijit Bashetti

Reputation: 8678

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

Upvotes: 3

Polynomial Proton
Polynomial Proton

Reputation: 5135

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

Put into elastic via postman

Upvotes: 4

Related Questions