When using SOLR via his HTTP Api, he responds with an object called responseHeader
where he puts the status of the response
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">13</int>
<!-- ... -->
</lst>
<!-- ... -->
</response>
My first question: What are the possible values of the status attribute? and what are their meanings?. I know that the value 0
means a successful call.
My second question: Normally, Solr responds with an 200 code for a successful call. Can we get a status
different than 0
(in case of an error) and still get 200 for the http response code?
I use SOLR 4.6
Nb: I asked those questions cause my SOLR doesn't index somme of the collections although he doesn't rise any error and the response code is 200!
Thank you
The status code usually corresponds to the HTTP code given back, except for 200 being returned as 0. This is implemented as the numeric code when a SolrException is thrown interally in Solr. When this was asked on the solr-user mailing list a while back, the following answer from Erik Hatcher was given:
Is there a reference to this status-codes?
Just the source code. SolrCore#setResponseHeaderValues, which predominately uses the codes specified in SolrException:
BAD_REQUEST( 400 ), UNAUTHORIZED( 401 ), // not currently used FORBIDDEN( 403 ), NOT_FOUND( 404 ), SERVER_ERROR( 500 ), SERVICE_UNAVAILABLE( 503 ), UNKNOWN(0);
The current version of SolrCore can be seen on Github.
You can probably assume that the http error code will match the status
value most of the time, but there's certainly exceptions - for example if the HTTP request never reaches Solr at all, and the error is just returned by jetty instead (if the installations is severely borked, or possibly if you try to access something other than /solr).
In your example, the request can be perfectly fine and OK, even if the action doesn't trigger anything when importing data to a collection. If your import query ends up in 0 documents, that isn't an error - and if the import started (an import is usually a async operation), that's still a valid and OK request, even if the end result later isn't valid.
It's probably better to try to understand why your import is failing (and use a separate question for that with all the relevant details about how you're trying to index, what any errors in the log say (you can adjust the log level under Logging in the web interface) and what you expected the result to be), instead of looking at the status
field in the response.