Class yii\elasticsearch\Command
Inheritance | yii\elasticsearch\Command » yii\base\Component » yii\base\Object |
---|---|
Implements | yii\base\Configurable |
Available since version | 2.0 |
Source Code | https://github.com/yiisoft/yii2-elasticsearch/blob/master/Command.php |
The Command class implements the API for accessing the elasticsearch REST API.
Check the elasticsearch guide for details on these commands.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$behaviors | yii\base\Behavior[] | List of behaviors attached to this component | yii\base\Component |
$db | yii\elasticsearch\Connection | yii\elasticsearch\Command | |
$index | string|array | The indexes to execute the query on. | yii\elasticsearch\Command |
$indexStatus | mixed | yii\elasticsearch\Command | |
$mapping | mixed | yii\elasticsearch\Command | |
$options | yii\elasticsearch\Command | ||
$queryParts | array | List of arrays or json strings that become parts of a query | yii\elasticsearch\Command |
$type | string|array | The types to execute the query on. | yii\elasticsearch\Command |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Component |
__construct() | Constructor. | yii\base\Object |
__get() | Returns the value of a component property. | yii\base\Component |
__isset() | Checks if a property is set, i.e. defined and not null. | yii\base\Component |
__set() | Sets the value of a component property. | yii\base\Component |
__unset() | Sets a component property to be null. | yii\base\Component |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
behaviors() | Returns a list of behaviors that this component should behave as. | yii\base\Component |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\base\Component |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\base\Component |
className() | Returns the fully qualified name of this class. | yii\base\Object |
clearIndexCache() | yii\elasticsearch\Command | |
closeIndex() | yii\elasticsearch\Command | |
createIndex() | Creates an index | yii\elasticsearch\Command |
createTemplate() | yii\elasticsearch\Command | |
delete() | Deletes a document from the index | yii\elasticsearch\Command |
deleteAllIndexes() | Deletes all indexes | yii\elasticsearch\Command |
deleteByQuery() | Sends a request to the delete by query | yii\elasticsearch\Command |
deleteIndex() | Deletes an index | yii\elasticsearch\Command |
deleteMapping() | yii\elasticsearch\Command | |
deleteTemplate() | yii\elasticsearch\Command | |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
exists() | Gets a document from the index | yii\elasticsearch\Command |
flushIndex() | yii\elasticsearch\Command | |
get() | Gets a document from the index | yii\elasticsearch\Command |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
getIndexStatus() | yii\elasticsearch\Command | |
getMapping() | yii\elasticsearch\Command | |
getSource() | Gets a documents _source from the index (>=v0.90.1) | yii\elasticsearch\Command |
getTemplate() | yii\elasticsearch\Command | |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
indexExists() | Checks whether an index exists | yii\elasticsearch\Command |
init() | Initializes the object. | yii\base\Object |
insert() | Inserts a document into an index | yii\elasticsearch\Command |
mget() | Gets multiple documents from the index | yii\elasticsearch\Command |
off() | Detaches an existing event handler from this component. | yii\base\Component |
on() | Attaches an event handler to an event. | yii\base\Component |
openIndex() | yii\elasticsearch\Command | |
refreshIndex() | yii\elasticsearch\Command | |
search() | Sends a request to the _search API and returns the result | yii\elasticsearch\Command |
setMapping() | yii\elasticsearch\Command | |
suggest() | Sends a request to the _suggest API and returns the result | yii\elasticsearch\Command |
trigger() | Triggers an event. | yii\base\Component |
typeExists() | yii\elasticsearch\Command | |
update() | Updates a document | yii\elasticsearch\Command |
Property Details
The indexes to execute the query on. Defaults to null meaning all indexes
List of arrays or json strings that become parts of a query
The types to execute the query on. Defaults to null meaning all types
Method Details
mixed clearIndexCache( $index ) | ||
$index |
mixed closeIndex( $index ) | ||
$index |
Creates an index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html.
mixed createIndex( $index, $configuration = null ) | ||
$index | ||
$configuration | array |
mixed createTemplate( $name, $pattern, $settings, $mappings, $order = 0 ) | ||
$name | ||
$pattern | ||
$settings | ||
$mappings | ||
$order | integer |
Deletes a document from the index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html.
mixed delete( $index, $type, $id, $options = [] ) | ||
$index | ||
$type | ||
$id | ||
$options | array |
Deletes all indexes
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html.
mixed deleteAllIndexes( ) |
Sends a request to the delete by query
mixed deleteByQuery( $options = [] ) | ||
$options | array |
Deletes an index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html.
mixed deleteIndex( $index ) | ||
$index |
mixed deleteMapping( $index, $type ) | ||
$index | ||
$type |
mixed deleteTemplate( $name ) | ||
$name |
Gets a document from the index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html.
mixed exists( $index, $type, $id ) | ||
$index | ||
$type | ||
$id |
mixed flushIndex( $index = '_all' ) | ||
$index |
Gets a document from the index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html.
mixed get( $index, $type, $id, $options = [] ) | ||
$index | ||
$type | ||
$id | ||
$options | array |
mixed getIndexStatus( $index = '_all' ) | ||
$index |
mixed getMapping( $index = '_all', $type = '_all' ) | ||
$index | string | |
$type | string |
Gets a documents _source from the index (>=v0.90.1)
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source.
mixed getSource( $index, $type, $id ) | ||
$index | ||
$type | ||
$id |
mixed getTemplate( $name ) | ||
$name |
Checks whether an index exists
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html.
mixed indexExists( $index ) | ||
$index |
Inserts a document into an index
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html.
mixed insert( $index, $type, $data, $id = null, $options = [] ) | ||
$index | string | |
$type | string | |
$data | string|array | Json string or array of data to store |
$id | null | The documents id. If not specified Id will be automatically chosen |
$options | array |
Gets multiple documents from the index
TODO allow specifying type and index + fields
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html.
mixed mget( $index, $type, $ids, $options = [] ) | ||
$index | ||
$type | ||
$ids | ||
$options | array |
mixed openIndex( $index ) | ||
$index |
mixed refreshIndex( $index ) | ||
$index |
Sends a request to the _search API and returns the result
mixed search( $options = [] ) | ||
$options | array |
mixed setMapping( $index, $type, $mapping, $options = [] ) | ||
$index | ||
$type | ||
$mapping | ||
$options |
Sends a request to the _suggest API and returns the result
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html.
mixed suggest( $suggester, $options = [] ) | ||
$suggester | string|array | The suggester body |
$options | array |
mixed typeExists( $index, $type ) | ||
$index | ||
$type |
Updates a document
See also http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html.
mixed update( $index, $type, $id, $data, $options = [] ) | ||
$index | ||
$type | ||
$id | ||
$data | ||
$options | array |