$_name
$_name : string
Index name.
Elastica index object.
Handles reads, deletes and configurations of an index
$_client : \Elastica\Client
Client object.
__construct(\Elastica\Client $client, string $name)
Creates a new index object.
All the communication to and from an index goes of this object
\Elastica\Client | $client | Client object |
string | $name | Index name |
getStats() : \Elastica\Index\Stats
Return Index Stats.
getRecovery() : \Elastica\Index\Recovery
Return Index Recovery.
setMapping(\Elastica\Mapping $mapping, array $query = array()) : \Elastica\Response
Sets the mappings for the current index.
\Elastica\Mapping | $mapping | MappingType object |
array | $query | querystring when put mapping (for example update_all_types) |
getSettings() : \Elastica\Index\Settings
Returns the index settings object.
Settings object
updateDocuments(array<mixed,\Elastica\Document> $docs, array $options = array()) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
array | $options | Array of query params to use for query. For possible options check es api |
updateByQuery(\Elastica\Query|string|array $query, \Elastica\Script\AbstractScript $script, array $options = array()) : \Elastica\Response
Update entries in the db based on a query.
\Elastica\Query|string|array | $query | Query object or array |
\Elastica\Script\AbstractScript | $script | Script |
array | $options | Optional params |
addDocument(\Elastica\Document $doc) : \Elastica\Response
Adds the given document to the search index.
\Elastica\Document | $doc | Document with data |
addDocuments(array|array<mixed,\Elastica\Document> $docs, array $options = array()) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
array | $options | Array of query params to use for query. For possible options check es api |
getDocument(integer|string $id, array $options = array()) : \Elastica\Document
Get the document from search index.
integer|string | $id | Document id |
array | $options | options for the get request |
deleteById(string $id, array $options = array()) : \Elastica\Response
Deletes a document by its unique identifier.
string | $id | Document id |
array | $options |
Response object
deleteByQuery(\Elastica\Query|\Elastica\Query\AbstractQuery|string|array $query, array $options = array()) : \Elastica\Response
Deletes entries in the db based on a query.
\Elastica\Query|\Elastica\Query\AbstractQuery|string|array | $query | Query object or array |
array | $options | Optional params |
delete() : \Elastica\Response
Deletes the index.
Response object
deleteDocuments(array|array<mixed,\Elastica\Document> $docs) : \Elastica\Bulk\ResponseSet
Uses _bulk to delete documents from the server.
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
forcemerge(array $args = array()) : \Elastica\Response
Force merges index.
Detailed arguments can be found here in the link
array | $args | OPTIONAL Additional arguments |
refresh() : \Elastica\Response
Refreshes the index.
Response object
create(array $args = array(), boolean|array $options = null) : \Elastica\Response
Creates a new index with the given arguments.
array | $args | OPTIONAL Arguments to use |
boolean|array | $options | OPTIONAL bool=> Deletes index first if already exists (default = false). array => Associative array of options (option=>value) |
Server response
createSearch(string|array|\Elastica\Query $query = '', integer|array $options = null, \Elastica\ResultSet\BuilderInterface $builder = null) : \Elastica\Search
string|array|\Elastica\Query | $query | |
integer|array | $options | |
\Elastica\ResultSet\BuilderInterface | $builder |
search(string|array|\Elastica\Query $query = '', integer|array $options = null, string $method = \Elastica\Request::POST) : \Elastica\ResultSet
Searches in this index.
{ "from" : 0, "size" : 10, "sort" : { "postDate" : {"order" : "desc"}, "user" : { }, "_score" : { } }, "query" : { "term" : { "user" : "kimchy" } } }
string|array|\Elastica\Query | $query | Array with all query data inside or a Elastica\Query object |
integer|array | $options | OPTIONAL Limit or associative array of options (option=>value) |
string | $method | OPTIONAL Request method (use const's) (default = Request::POST) |
with all results inside
count(string|array|\Elastica\Query $query = '', string $method = \Elastica\Request::POST) : integer
Counts results of query.
If no query is set, matchall query is created
string|array|\Elastica\Query | $query | Array with all query data inside or a Elastica\Query object |
string | $method | OPTIONAL Request method (use const's) (default = Request::POST) |
number of documents matching the query
open() : \Elastica\Response
Opens an index.
Response object
close() : \Elastica\Response
Closes the index.
Response object
getClient() : \Elastica\Client
Returns index client.
Index client object
addAlias(string $name, boolean $replace = false) : \Elastica\Response
Adds an alias to the current index.
string | $name | Alias name |
boolean | $replace | OPTIONAL If set, an existing alias will be replaced |
Response
removeAlias(string $name) : \Elastica\Response
Removes an alias pointing to the current index.
string | $name | Alias name |
Response
clearCache() : \Elastica\Response
Clears the cache of an index.
Response object
flush(array $options = array()) : \Elastica\Response
Flushes the index to storage.
array | $options |
Response object
setSettings(array $data) : \Elastica\Response
Can be used to change settings during runtime. One example is to use it for bulk updating.
array | $data | Data array |
Response object
request(string $path, string $method, array|string $data = array(), array $query = array()) : \Elastica\Response
Makes calls to the elasticsearch server based on this index.
string | $path | Path to call |
string | $method | Rest method to use (GET, POST, DELETE, PUT) |
array|string | $data | OPTIONAL Arguments as array or encoded string |
array | $query | OPTIONAL Query params |
Response object
requestEndpoint(\Elasticsearch\Endpoints\AbstractEndpoint $endpoint) : \Elastica\Response
Makes calls to the elasticsearch server with usage official client Endpoint based on this index.
\Elasticsearch\Endpoints\AbstractEndpoint | $endpoint |
updateDocument(\Elastica\Document|\Elastica\Script\AbstractScript $data, array $options = array()) : \Elastica\Response
Update document, using update script.
\Elastica\Document|\Elastica\Script\AbstractScript | $data | Document or Script with update data |
array | $options | array of query params to use for query |