include/SugarSearchEngine/Elastic/Elastica/Index.php
Elastica index object
Handles reads, deletes and configurations of an index
- Author
- Nicolas Ruflin
- Category
- Xodoa
- Package
- Elastica
\Elastica_Index
Elastica index object
Handles reads, deletes and configurations of an index
- Parent(s)
- \Elastica_Searchable
- Author
- Nicolas Ruflin
- Category
- Xodoa
Properties
Methods
__construct(
\Elastica_Client $client, string $name
)
:
void
Creates a new index object
All the communication to and from an index goes of this object
Name | Type | Description |
---|---|---|
$client | \Elastica_Client | Client object |
$name | string | Index name |
addAlias(
string $name, bool $replace
=
false
)
:
\Elastica_Response
Adds an alias to the current index
Name | Type | Description |
---|---|---|
$name | string | Alias name |
$replace | bool | OPTIONAL If set, an existing alias will be replaced |
Type | Description |
---|---|
\Elastica_Response | Response |
addDocuments(
array $docs
)
:
void
Uses _bulk to send documents to the server
Name | Type | Description |
---|---|---|
$docs | array | Array of Elastica_Document |
clearCache(
)
:
\Elastica_Response
Clears the cache of an index
Type | Description |
---|---|
\Elastica_Response | Reponse object |
close(
)
:
\Elastica_Response
Closes the index
Type | Description |
---|---|
\Elastica_Response | Response object |
count(
string | array | \Elastica_Query $query
=
''
)
:
int
Counts results of query
Name | Type | Description |
---|---|---|
$query | string | array | \Elastica_Query | Array with all query data inside or a Elastica_Query object |
Type | Description |
---|---|
int | number of documents matching the query |
create(
array $args
=
array(), bool $recreate
=
false
)
:
array
Creates a new index with the given arguments
Name | Type | Description |
---|---|---|
$args | array | OPTIONAL Arguments to use |
$recreate | bool | OPTIONAL Deletes index first if already exists (default = false) |
Type | Description |
---|---|
array | Server response |
delete(
)
:
\Elastica_Response
Deletes the index
Type | Description |
---|---|
\Elastica_Response | Response object |
flush(
)
:
\Elastica_Response
Flushs the index to storage
Type | Description |
---|---|
\Elastica_Response | Reponse object |
getClient(
)
:
\Elastica_Client
Returns index client
Type | Description |
---|---|
\Elastica_Client | Index client object |
getSettings(
)
:
\Elastica_Index_Settings
Returns the index settings object
Type | Description |
---|---|
\Elastica_Index_Settings | Settings object |
getStatus(
)
:
\Elastica_Index_Status
Returns the current status of the index
Type | Description |
---|---|
\Elastica_Index_Status | Index status |
getType(
string $type
)
:
\Elastica_Type
Returns a type object for the current index with the given name
Name | Type | Description |
---|---|---|
$type | string | Type name |
Type | Description |
---|---|
\Elastica_Type | Type object |
open(
)
:
\Elastica_Response
Opens an index
Type | Description |
---|---|
\Elastica_Response | Response object |
optimize(
array $args
=
array()
)
:
array
Optimizes search index
Detailed arguments can be found here in the link
Name | Type | Description |
---|---|---|
$args | array | OPTIONAL Additional arguments |
Type | Description |
---|---|
array | Server response |
refresh(
)
:
\Elastica_Response
Refreshs the index
Type | Description |
---|---|
\Elastica_Response | Response object |
removeAlias(
string $name
)
:
\Elastica_Response
Removes an alias pointing to the current index
Name | Type | Description |
---|---|---|
$name | string | Alias name |
Type | Description |
---|---|
\Elastica_Response | Response |
request(
string $path, string $method, array $data
=
array()
)
:
\Elastica_Response
Makes calls to the elasticsearch server based on this index
Name | Type | Description |
---|---|---|
$path | string | Path to call |
$method | string | Rest method to use (GET, POST, DELETE, PUT) |
$data | array | OPTIONAL Arguments as array |
Type | Description |
---|---|
\Elastica_Response | Response object |
search(
string | array | \Elastica_Query $query, int $limit
=
0
)
:
\Elastica_ResultSet
Searchs in this index
Name | Type | Description |
---|---|---|
$query | string | array | \Elastica_Query | Array with all query data inside or a Elastica_Query object |
$limit | int | OPTIONAL |
Type | Description |
---|---|
\Elastica_ResultSet | ResultSet with all results inside |
setSettings(
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}
Name | Type | Description |
---|---|---|
$data | array | Data array |
Type | Description |
---|---|
\Elastica_Response | Response object |