$_config
$_config : \Elastica\ClientConfiguration
Client to connect the the elasticsearch server.
$_config : \Elastica\ClientConfiguration
$_connectionPool : \Elastica\Connection\ConnectionPool
$_lastRequest : \Elastica\Request|null
$_lastResponse : \Elastica\Response|null
__construct(array|string $config = array(), callback|null $callback = null, \Psr\Log\LoggerInterface $logger = null)
Creates a new Elastica client.
array|string | $config | OPTIONAL Additional config or DSN of options |
callback|null | $callback | OPTIONAL Callback function which can be used to be notified about errors (for example connection down) |
\Psr\Log\LoggerInterface | $logger |
getIndex(string $name) : \Elastica\Index
Returns the index for the given connection.
string | $name | Index name to create connection to |
Index for the given name
updateDocuments(array|array<mixed,\Elastica\Document> $docs, array $requestParams = array()) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
Array of \Elastica\Document as input. Index has to be set inside the document, because for bulk settings documents, documents can belong to any index
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
array | $requestParams |
If docs is empty
Response object
addDocuments(array|array<mixed,\Elastica\Document> $docs, array $requestParams = array()) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
Array of \Elastica\Document as input. Index has to be set inside the document, because for bulk settings documents, documents can belong to any index
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
array | $requestParams |
If docs is empty
Response object
updateDocument(integer|string $id, array|\Elastica\Script\AbstractScript|\Elastica\Document $data, string $index, array $options = array()) : \Elastica\Response
Update document, using update script. Requires elasticsearch >= 0.19.0.
integer|string | $id | document id |
array|\Elastica\Script\AbstractScript|\Elastica\Document | $data | raw data for request body |
string | $index | index to update |
array | $options | array of query params to use for query. For possible options check es api |
deleteDocuments(array|array<mixed,\Elastica\Document> $docs, array $requestParams = array()) : \Elastica\Bulk\ResponseSet
Bulk deletes documents.
array|array<mixed,\Elastica\Document> | $docs | |
array | $requestParams |
getStatus() : \Elastica\Status
Returns the status object for all indices.
Status object
getCluster() : \Elastica\Cluster
Returns the current cluster.
Cluster object
addConnection(\Elastica\Connection $connection) : $this
\Elastica\Connection | $connection |
getConnection() : \Elastica\Connection
getConnections() : array<mixed,\Elastica\Connection>
getConnectionStrategy() : \Elastica\Connection\Strategy\StrategyInterface
setConnections(array|array<mixed,\Elastica\Connection> $connections) : $this
array|array<mixed,\Elastica\Connection> | $connections |
deleteIds(array $ids, string|\Elastica\Index $index, string|boolean $routing = false) : \Elastica\Bulk\ResponseSet
Deletes documents with the given ids, index, type from the index.
array | $ids | Document ids |
string|\Elastica\Index | $index | Index name |
string|boolean | $routing | Optional routing key for all ids |
Response object
bulk(array $params) : \Elastica\Bulk\ResponseSet
Bulk operation.
Every entry in the params array has to exactly on array of the bulk operation. An example param array would be:
array( array('index' => array('_index' => 'test', '_id' => '1')), array('field1' => 'value1'), array('delete' => array('_index' => 'test', '_id' => '2')), array('create' => array('_index' => 'test', '_id' => '3')), array('field1' => 'value3'), array('update' => array('_id' => '1', '_index' => 'test')), array('doc' => array('field2' => 'value2')), );
array | $params | Parameter array |
Response object
request(string $path, string $method = \Elastica\Request::GET, array|string $data = array(), array $query = array(), string $contentType = \Elastica\Request::DEFAULT_CONTENT_TYPE) : \Elastica\Response
Makes calls to the elasticsearch server based on this index.
It's possible to make any REST query directly over this method
string | $path | Path to call |
string | $method | Rest method to use (GET, POST, DELETE, PUT) |
array|string | $data | OPTIONAL Arguments as array or pre-encoded string |
array | $query | OPTIONAL Query params |
string | $contentType | Content-Type sent with this request |
Response object
requestEndpoint(\Elasticsearch\Endpoints\AbstractEndpoint $endpoint) : \Elastica\Response
Makes calls to the elasticsearch server with usage official client Endpoint.
\Elasticsearch\Endpoints\AbstractEndpoint | $endpoint |
forcemergeAll(array $args = array()) : \Elastica\Response
Force merges all search indices.
array | $args | OPTIONAL Optional arguments |
Response object
refreshAll() : \Elastica\Response
Refreshes all search indices.
Response object
getLastRequest() : \Elastica\Request|null
getLastResponse() : \Elastica\Response|null