include/SugarSearchEngine/Elastic/Elastica/Index.php

Show: inherited
Table of Contents

Elastica index object

Handles reads, deletes and configurations of an index

Author
Nicolas Ruflin  
Category
Xodoa  
Package
Elastica  

\Elastica_Index

Package: Elastica

Elastica index object

Handles reads, deletes and configurations of an index

Parent(s)
\Elastica_Searchable
Author
Nicolas Ruflin  
Category
Xodoa  

Properties

Propertyprotected\Elastica_Client  $_client= 'null'

Client object
Default valuenullDetails
Type
\Elastica_Client
Propertyprotectedstring  $_name= ''''

Index name
Default value''Details
Type
string

Methods

methodpublic__construct( \Elastica_Client $client, string $name ) : void

Creates a new index object

All the communication to and from an index goes of this object

Parameters
Name Type Description
$client \Elastica_Client

Client object

$name string

Index name

methodpublicaddAlias( string $name, bool $replace = false ) : \Elastica_Response

Adds an alias to the current index

Parameters
Name Type Description
$name string

Alias name

$replace bool

OPTIONAL If set, an existing alias will be replaced

Returns
Type Description
\Elastica_Response Response
Details
Link
http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html  
methodpublicaddDocuments( array $docs ) : void

Uses _bulk to send documents to the server

Parameters
Name Type Description
$docs array

Array of Elastica_Document

Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/bulk/  
methodpublicclearCache( ) : \Elastica_Response

Clears the cache of an index

methodpublicclose( ) : \Elastica_Response

Closes the index

methodpubliccount( string | array | \Elastica_Query $query = '' ) : int

Counts results of query

Parameters
Name Type Description
$query string | array | \Elastica_Query

Array with all query data inside or a Elastica_Query object

Returns
Type Description
int number of documents matching the query
Details
See
\Elastica_Searchable::count  
methodpubliccreate( array $args = array(), bool $recreate = false ) : array

Creates a new index with the given arguments

Parameters
Name Type Description
$args array

OPTIONAL Arguments to use

$recreate bool

OPTIONAL Deletes index first if already exists (default = false)

Returns
Type Description
array Server response
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/create_index/  
methodpublicdelete( ) : \Elastica_Response

Deletes the index

Returns
Type Description
\Elastica_Response Response object
methodpublicflush( ) : \Elastica_Response

Flushs the index to storage

methodpublicgetClient( ) : \Elastica_Client

Returns index client

Returns
Type Description
\Elastica_Client Index client object
methodpublicgetName( ) : string

Returns the index name

Returns
Type Description
string Index name
methodpublicgetSettings( ) : \Elastica_Index_Settings

Returns the index settings object

Returns
Type Description
\Elastica_Index_Settings Settings object
methodpublicgetStats( ) : \ELastica_Index_Stats

Returns
Type Description
\ELastica_Index_Stats
methodpublicgetStatus( ) : \Elastica_Index_Status

Returns the current status of the index

Returns
Type Description
\Elastica_Index_Status Index status
methodpublicgetType( string $type ) : \Elastica_Type

Returns a type object for the current index with the given name

Parameters
Name Type Description
$type string

Type name

Returns
Type Description
\Elastica_Type Type object
methodpublicopen( ) : \Elastica_Response

Opens an index

methodpublicoptimize( array $args = array() ) : array

Optimizes search index

Detailed arguments can be found here in the link

Parameters
Name Type Description
$args array

OPTIONAL Additional arguments

Returns
Type Description
array Server response
Details
Link
http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/optimize/  
methodpublicrefresh( ) : \Elastica_Response

Refreshs the index

methodpublicremoveAlias( string $name ) : \Elastica_Response

Removes an alias pointing to the current index

Parameters
Name Type Description
$name string

Alias name

Returns
Type Description
\Elastica_Response Response
Details
Link
http://www.elasticsearch.org/guide/reference/api/admin-indices-aliases.html  
methodpublicrequest( string $path, string $method, array $data = array() ) : \Elastica_Response

Makes calls to the elasticsearch server based on this index

Parameters
Name Type Description
$path string

Path to call

$method string

Rest method to use (GET, POST, DELETE, PUT)

$data array

OPTIONAL Arguments as array

Returns
Type Description
\Elastica_Response Response object
methodpublicsearch( string | array | \Elastica_Query $query, int $limit = 0 ) : \Elastica_ResultSet

Searchs in this index

Parameters
Name Type Description
$query string | array | \Elastica_Query

Array with all query data inside or a Elastica_Query object

$limit int

OPTIONAL

Returns
Type Description
\Elastica_ResultSet ResultSet with all results inside
Details
See
\Elastica_Searchable::search  
methodpublicsetSettings( array $data ) : \Elastica_Response

Can be used to change settings during runtime. One example is to use if for bulk updating {@link http://www.elasticsearch.org/blog/2011/03/23/update-settings.html}

Parameters
Name Type Description
$data array

Data array

Returns
Type Description
\Elastica_Response Response object
Details
Link
http://www.elasticsearch.org/guide/reference/api/admin-indices-update-settings.html  
Documentation was generated by DocBlox 0.18.1.