Find number of rows/documents inserted by curl command


(Bhupendra Bagde) #1

Hi ,
Can anyone please tell hwo to find number of rows/documents inserted by curl command in elastic search.
Lets say I have json file with 2k rowcount. I want to verify all 2k rows has been inserted by curl successfully (out of 2k only 1k inserted ) like that.

curl -XPUT 'localhost:9200/indexname/_bulk' -H 'Content-Type: application/json' --data-binary @filename.json


(David Pilato) #2
curl -XGET 'localhost:9200/indexname/_search?size=0'

(Bhupendra Bagde) #3

Thanks,
It gives total no of documents in index only.
I want to find out how many documents inserted by last command.
basically I want to re-check no. of rows in my csv file are all inserted in elasticsearch.


(David Pilato) #4

This is unclear to me.

If you want to compare the number of lines in your CSV with what you have indexed, then count the number of lines in your CSV and compare this number with the response of:

curl -XGET 'localhost:9200/indexname/_search?size=0'

If you want to compare what has been recently inserted, then you need to have the insertion time in your documents and do a range query to only filter recent documents.