Missing Index 404


I'm facing this issue when i updated ES to 2.0.0.
I updated my ES PHP client to ~2.0.

Initializing client like this :

$logger = ClientBuilder::defaultLogger(DIR.'/es.log', Logger::INFO);
$params = array(

$clientBuilder = ClientBuilder::create(); // Instantiate a new ClientBuilder
$client = $clientBuilder->build();

But unfortunately getting this error although i have created 'testindex'. :frowning:

[Tue Nov 17 16:37:45.744937 2015] [:error] [pid 6400] [client] PHP Fatal error: Uncaught exception 'Elasticsearch\Common\Exceptions\Missing404Exception' with message '{"found":false,"_index":"testindex","_type":"data","_id":"_query","_version":3,"_shards":{"total":2,"successful":1,"failed":0}}'

Thank you

Not sure about what you did but here you asked to GET a document in index testindex, with type data and id query.

This document does not exist.


First issue :
I was calling :
$aFlushParams = array();
$aFlushParams['index'] = $index;
$aFlushParams['type'] = $type;
$aFlushParams['body'] = array(
'query' => array(
'match_all' => array()

and getting the error above. (mentioned in above post)

Second issue :

On bulk insert :

$formattedDocument['body'] = array();

foreach ($document as $valueDoc) {

$formattedDocument['body'][] = array(

    'index' => array(
        '_index' => $index,
        '_type' => $type,
        '_id' => $valueDoc['id']

$formattedDocument['body'][] = $valueDoc;


It works fine for 10 - 20k documents but after this it ends up throwing this below exception.

Uncaught exception 'Elasticsearch\Common\Exceptions\TransportException' with message 'cURL error 56: Recv failure: Connection reset by peer'

Any work around for this? Or do i need to reconnect to ES and send data in chunks?

Thank you

The first issue (delete by query) is because that API has been removed from core Elasticsearch in 2.0. It is now a plugin, see: https://www.elastic.co/blog/core-delete-by-query-is-a-plugin

Regarding the second issue, it sounds like a problem with your cluster and not the client. You don't need to reconnect the client between operations, it manages all of that for you.

Can you add the logs from your ES node/cluster? Perhaps there is a clue in there about what's going wrong?


Thanks for letting me know.

I fixed that issue by sending data in chunks. cheers :wink: