Missing Index 404


(Rabeet waqar) #1

Hi,

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(
'127.0.0.1:9200'
);

$clientBuilder = ClientBuilder::create(); // Instantiate a new ClientBuilder
$clientBuilder->setHosts($params);
$clientBuilder->setLogger($logger);
$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 127.0.0.1:42646] 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


(David Pilato) #2

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.


(Rabeet waqar) #3

Hello,

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

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;

}
$client->bulk($formattedDocument);

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


(Zachary Tong) #4

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?


(Rabeet waqar) #5

Hello,

Thanks for letting me know.

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


(system) #6