PHP Class yii\elasticsearch\Command

Check the elasticsearch guide for details on these commands.
Since: 2.0
Author: Carsten Brandt ([email protected])
Inheritance: extends yii\base\Component
Afficher le fichier Open project: yiisoft/yii2-elasticsearch Class Usage Examples

Méthodes publiques

Свойство Type Description
$db Connection
$index the indexes to execute the query on. Defaults to null meaning all indexes
$options options to be appended to the query URL, such as "search_type" for search or "timeout" for delete
$queryParts list of arrays or json strings that become parts of a query
$type the types to execute the query on. Defaults to null meaning all types

Méthodes publiques

Méthode Description
clearIndexCache ( $index ) : mixed
clearScroll ( array $options = [] ) : mixed
closeIndex ( $index ) : mixed
createIndex ( $index, array $configuration = null ) : mixed creates an index
createTemplate ( $name, $pattern, $settings, $mappings, integer $order ) : mixed
delete ( $index, $type, $id, array $options = [] ) : mixed deletes a document from the index
deleteAllIndexes ( ) : mixed deletes all indexes
deleteByQuery ( array $options = [] ) : mixed Sends a request to the delete by query
deleteIndex ( $index ) : mixed deletes an index
deleteMapping ( $index, $type ) : mixed
deleteTemplate ( $name ) : mixed
exists ( $index, $type, $id ) : mixed gets a document from the index
flushIndex ( $index = '_all' ) : mixed
get ( $index, $type, $id, array $options = [] ) : mixed gets a document from the index
getIndexStatus ( $index = '_all' ) : mixed
getMapping ( string $index = '_all', string $type = null ) : mixed
getSource ( $index, $type, $id ) : mixed gets a documents _source from the index (>=v0.90.1)
getTemplate ( $name ) : mixed
indexExists ( $index ) : mixed checks whether an index exists
insert ( string $index, string $type, string | array $data, null $id = null, array $options = [] ) : mixed Inserts a document into an index
mget ( $index, $type, $ids, array $options = [] ) : mixed gets multiple documents from the index
openIndex ( $index ) : mixed
refreshIndex ( $index ) : mixed
scroll ( array $options = [] ) : mixed
search ( array $options = [] ) : mixed Sends a request to the _search API and returns the result
setMapping ( string $index, string $type, string | array $mapping, array $options = [] ) : mixed
suggest ( string | array $suggester, array $options = [] ) : mixed Sends a request to the _suggest API and returns the result
typeExists ( $index, $type ) : mixed
update ( $index, $type, $id, $data, array $options = [] ) : mixed updates a document
updateAnalyzers ( string $index, string | array $setting, array $options = [] ) : mixed Define new analyzers for the index.
updateSettings ( string $index, string | array $setting, array $options = [] ) : mixed Change specific index level settings in real time.

Method Details

clearIndexCache() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-clearcache.html
public clearIndexCache ( $index ) : mixed
$index
Résultat mixed

clearScroll() public méthode

See also: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
Since: 2.0.4
public clearScroll ( array $options = [] ) : mixed
$options array
Résultat mixed

closeIndex() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
public closeIndex ( $index ) : mixed
$index
Résultat mixed

createIndex() public méthode

creates an index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html
public createIndex ( $index, array $configuration = null ) : mixed
$index
$configuration array
Résultat mixed

createTemplate() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
public createTemplate ( $name, $pattern, $settings, $mappings, integer $order ) : mixed
$name
$pattern
$settings
$mappings
$order integer
Résultat mixed

delete() public méthode

deletes a document from the index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html
public delete ( $index, $type, $id, array $options = [] ) : mixed
$index
$type
$id
$options array
Résultat mixed

deleteAllIndexes() public méthode

deletes all indexes
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
public deleteAllIndexes ( ) : mixed
Résultat mixed

deleteByQuery() public méthode

Sends a request to the delete by query
public deleteByQuery ( array $options = [] ) : mixed
$options array
Résultat mixed

deleteIndex() public méthode

deletes an index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html
public deleteIndex ( $index ) : mixed
$index
Résultat mixed

deleteMapping() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
public deleteMapping ( $index, $type ) : mixed
$index
$type
Résultat mixed

deleteTemplate() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
public deleteTemplate ( $name ) : mixed
$name
Résultat mixed

exists() public méthode

gets a document from the index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
public exists ( $index, $type, $id ) : mixed
$index
$type
$id
Résultat mixed

flushIndex() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-flush.html
public flushIndex ( $index = '_all' ) : mixed
$index
Résultat mixed

get() public méthode

gets a document from the index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html
public get ( $index, $type, $id, array $options = [] ) : mixed
$index
$type
$id
$options array
Résultat mixed

getIndexStatus() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-status.html
public getIndexStatus ( $index = '_all' ) : mixed
$index
Résultat mixed

getMapping() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html
public getMapping ( string $index = '_all', string $type = null ) : mixed
$index string
$type string
Résultat mixed

getSource() public méthode

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
public getSource ( $index, $type, $id ) : mixed
$index
$type
$id
Résultat mixed

getTemplate() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html
public getTemplate ( $name ) : mixed
$name
Résultat mixed

indexExists() public méthode

checks whether an index exists
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html
public indexExists ( $index ) : mixed
$index
Résultat mixed

insert() public méthode

Inserts a document into an index
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html
public insert ( string $index, string $type, string | array $data, null $id = null, array $options = [] ) : mixed
$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
Résultat mixed

mget() public méthode

TODO allow specifying type and index + fields
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
public mget ( $index, $type, $ids, array $options = [] ) : mixed
$index
$type
$ids
$options array
Résultat mixed

openIndex() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-open-close.html
public openIndex ( $index ) : mixed
$index
Résultat mixed

refreshIndex() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html
public refreshIndex ( $index ) : mixed
$index
Résultat mixed

scroll() public méthode

See also: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html
Since: 2.0.4
public scroll ( array $options = [] ) : mixed
$options array
Résultat mixed

setMapping() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html
public setMapping ( string $index, string $type, string | array $mapping, array $options = [] ) : mixed
$index string
$type string
$mapping string | array
$options array
Résultat mixed

suggest() public méthode

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
public suggest ( string | array $suggester, array $options = [] ) : mixed
$suggester string | array the suggester body
$options array
Résultat mixed

typeExists() public méthode

See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html
public typeExists ( $index, $type ) : mixed
$index
$type
Résultat mixed

update() public méthode

updates a document
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html
public update ( $index, $type, $id, $data, array $options = [] ) : mixed
$index
$type
$id
$options array
Résultat mixed

updateAnalyzers() public méthode

For example if content analyzer hasn’t been defined on "myindex" yet you can use the following commands to add it: ~~~ $setting = [ 'analysis' => [ 'analyzer' => [ 'ngram_analyzer_with_filter' => [ 'tokenizer' => 'ngram_tokenizer', 'filter' => 'lowercase, snowball' ], ], 'tokenizer' => [ 'ngram_tokenizer' => [ 'type' => 'nGram', 'min_gram' => 3, 'max_gram' => 10, 'token_chars' => ['letter', 'digit', 'whitespace', 'punctuation', 'symbol'] ], ], ] ]; $elasticQuery->createCommand()->updateAnalyzers('myindex', $setting); ~~~
See also: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-update-settings.html#update-settings-analysis
Since: 2.0.4
public updateAnalyzers ( string $index, string | array $setting, array $options = [] ) : mixed
$index string
$setting string | array
$options array URL options
Résultat mixed

updateSettings() public méthode

Note that update analyzers required to [[close()]] the index first and [[open()]] it after the changes are made, use Command::updateAnalyzers for it.
See also: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-update-settings.html
Since: 2.0.4
public updateSettings ( string $index, string | array $setting, array $options = [] ) : mixed
$index string
$setting string | array
$options array URL options
Résultat mixed

Property Details

$db public_oe property

public Connection,yii\elasticsearch $db
Résultat Connection

$index public_oe property

the indexes to execute the query on. Defaults to null meaning all indexes
See also: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#search-multi-index-type
public $index

$options public_oe property

options to be appended to the query URL, such as "search_type" for search or "timeout" for delete
public $options

$queryParts public_oe property

list of arrays or json strings that become parts of a query
public $queryParts

$type public_oe property

the types to execute the query on. Defaults to null meaning all types
public $type