Best way to check a document has been indexed

Hello,

I'm developing a piece of code that inserts a document into an
elastcisearch server. The code uses libcurl to setup an HTTP request and
capture the response.
So, in order to check wether a document has been properly indexed, what is
the official or proper way to do it?

This is an example of a correct indexed document response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=UTF-8
Content-Length: 92

{"_index":"someindex","_type":"sometype","_id":"fsAx6qXcQGCSrY1DWvQACw","_version":1,"created":true}

Should my program check that first header line contains "201 Created", what
should happen if a 3xx redirection occurs? should I consider it as properly
indexed too?

Or instead should I just ignore the header and just check that the last
part of the body string equals ' "created":true} ' ?

Thank you!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3b1ea5c6-61bf-4ce4-976a-705e17f3927f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi ,

Just check if its 200 ( Indexed ) or 201 ( Created ) .
HTTP status code alone should be sufficient.

Thanks
Vineeth

On Thu, Nov 20, 2014 at 4:01 PM, asanchez asanchez1987@gmail.com wrote:

Hello,

I'm developing a piece of code that inserts a document into an
elastcisearch server. The code uses libcurl to setup an HTTP request and
capture the response.
So, in order to check wether a document has been properly indexed, what is
the official or proper way to do it?

This is an example of a correct indexed document response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=UTF-8
Content-Length: 92

{"_index":"someindex","_type":"sometype","_id":"fsAx6qXcQGCSrY1DWvQACw","_version":1,"created":true}

Should my program check that first header line contains "201 Created",
what should happen if a 3xx redirection occurs? should I consider it as
properly indexed too?

Or instead should I just ignore the header and just check that the last
part of the body string equals ' "created":true} ' ?

Thank you!

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3b1ea5c6-61bf-4ce4-976a-705e17f3927f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3b1ea5c6-61bf-4ce4-976a-705e17f3927f%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nMsA%3DkFzSGwApWK-5f8mUmK8YdJuvKn_Zct7yn550Aeg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.