$_index
$_index : \Elastica\Index
Index.
Elastica type object.
elasticsearch has for every types as a substructure. This object represents a type inside a context The hierarchy is as following: client -> index -> type -> document
$_index : \Elastica\Index
Index.
__construct(\Elastica\Index $index, string $name)
Creates a new type object inside the given index.
\Elastica\Index | $index | Index Object |
string | $name | Type name |
addDocument(\Elastica\Document $doc) : \Elastica\Response
Adds the given document to the search index.
\Elastica\Document | $doc | Document with data |
addObject( $object, \Elastica\Document $doc = null) : \Elastica\Response
$object | ||
\Elastica\Document | $doc |
updateDocument(\Elastica\Document|\Elastica\Script\AbstractScript $data, array $options = array()) : \Elastica\Response
Update document, using update script. Requires elasticsearch >= 0.19.0.
\Elastica\Document|\Elastica\Script\AbstractScript | $data | Document with update data |
array | $options | array of query params to use for query. For possible options check es api |
updateDocuments(array|array<mixed,\Elastica\Document> $docs) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
addDocuments(array|array<mixed,\Elastica\Document> $docs) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
array|array<mixed,\Elastica\Document> | $docs | Array of Elastica\Document |
addObjects(array<mixed,\Elastica\objects> $objects) : \Elastica\Bulk\ResponseSet
Uses _bulk to send documents to the server.
array<mixed,\Elastica\objects> | $objects |
getDocument(string $id, array $options = array()) : \Elastica\Document
Get the document from search index.
string | $id | Document id |
array | $options | Options for the get request. |
createDocument(string $id = '', array|string $data = array()) : \Elastica\Document
string | $id | |
array|string | $data |
setMapping(\Elastica\Type\Mapping|array $mapping) : \Elastica\Response
Sets value type mapping for this type.
\Elastica\Type\Mapping|array | $mapping | Elastica\Type\MappingType object or property array with all mappings |
createSearch(string|array|\Elastica\Query $query = '', integer|array $options = null, \Elastica\ResultSet\BuilderInterface $builder = null) : \Elastica\Search
Create search object.
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) |
\Elastica\ResultSet\BuilderInterface | $builder |
search(string|array|\Elastica\Query $query = '', integer|array $options = null) : \Elastica\ResultSet
Do a search on this type.
TODO: Improve sample code { "from" : 0, "size" : 10, "sort" : { "postDate" : {"reverse" : true}, "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) |
with all results inside
count(string|array|\Elastica\Query $query = '') : integer
Count docs by 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 |
number of documents matching the query
getIndex() : \Elastica\Index
Returns index client.
Index object
deleteDocument(\Elastica\Document $document) : \Elastica\Response
\Elastica\Document | $document |
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 |
deleteById(integer|string $id, array $options = array()) : \Elastica\Response
Deletes an entry by its unique identifier.
integer|string | $id | Document id |
array | $options |
Response object
deleteIds(array $ids, string|boolean $routing = false) : \Elastica\Response
Deletes the given list of ids from this type.
array | $ids | |
string|boolean | $routing | Optional routing key for all ids |
Response object
deleteByQuery(\Elastica\Query|string $query, array $options = array()) : \Elastica\Response
Deletes entries in the db based on a query.
\Elastica\Query|string | $query | Query object |
array | $options | Optional params |
request(string $path, string $method, array $data = array(), array $query = array()) : \Elastica\Response
Makes calls to the elasticsearch server based on this type.
string | $path | Path to call |
string | $method | Rest method to use (GET, POST, DELETE, PUT) |
array | $data | OPTIONAL Arguments as array |
array | $query | OPTIONAL Query params |
Response object
None found |