PHP 클래스 Elastica\Index

Handles reads, deletes and configurations of an index
저자: Nicolas Ruflin ([email protected])
상속: implements elastica\SearchableInterface
파일 보기 프로젝트 열기: ruflin/elastica 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_client Client object.
$_name Index name.

공개 메소드들

메소드 설명
__construct ( Client $client, string $name ) Creates a new index object.
addAlias ( string $name, boolean $replace = false ) : Response Adds an alias to the current index.
addDocuments ( array $docs ) : ResponseSet Uses _bulk to send documents to the server.
analyze ( string $text, array $args = [] ) : array Analyzes a string.
clearCache ( ) : Response Clears the cache of an index.
close ( ) : Response Closes the index.
count ( string | array | Query $query = '' ) : integer Counts results of query.
create ( array $args = [], boolean | array $options = null ) : Response Creates a new index with the given arguments.
createSearch ( string | array | Query $query = '', integer | array $options = null, Elastica\ResultSet\BuilderInterface $builder = null ) : Search
delete ( ) : Response Deletes the index.
deleteByQuery ( Query | string | array $query, array $options = [] ) : Response Deletes entries in the db based on a query.
deleteDocuments ( array $docs ) : ResponseSet Uses _bulk to delete documents from the server.
exists ( ) : boolean Checks if the given index is already created.
flush ( $options = [] ) : Response Flushes the index to storage.
forcemerge ( array $args = [] ) : array Force merges index.
getAliases ( ) : array Returns all index aliases.
getClient ( ) : Client Returns index client.
getMapping ( ) : array Gets all the type mappings for an index.
getName ( ) : string Returns the index name.
getSettings ( ) : Settings Returns the index settings object.
getStats ( ) : Stats Return Index Stats.
getType ( string $type ) : Type Returns a type object for the current index with the given name.
hasAlias ( string $name ) : boolean Checks if the index has the given alias.
open ( ) : Response Opens an index.
optimize ( array $args = [] ) : array Optimizes search index.
refresh ( ) : Response Refreshes the index.
removeAlias ( string $name ) : Response Removes an alias pointing to the current index.
request ( string $path, string $method, array | string $data = [], array $query = [] ) : Response Makes calls to the elasticsearch server based on this index.
search ( string | array | Query $query = '', integer | array $options = null ) : ResultSet Searches in this index.
setSettings ( array $data ) : Response Can be used to change settings during runtime. One example is to use it for bulk updating.
updateDocuments ( array $docs ) : ResponseSet Uses _bulk to send documents to the server.

메소드 상세

__construct() 공개 메소드

All the communication to and from an index goes of this object
public __construct ( Client $client, string $name )
$client Client Client object
$name string Index name

addAlias() 공개 메소드

Adds an alias to the current index.
public addAlias ( string $name, boolean $replace = false ) : Response
$name string Alias name
$replace boolean OPTIONAL If set, an existing alias will be replaced
리턴 Response Response

addDocuments() 공개 메소드

Uses _bulk to send documents to the server.
public addDocuments ( array $docs ) : ResponseSet
$docs array Array of Elastica\Document
리턴 Elastica\Bulk\ResponseSet

analyze() 공개 메소드

Detailed arguments can be found here in the link
public analyze ( string $text, array $args = [] ) : array
$text string String to be analyzed
$args array OPTIONAL Additional arguments
리턴 array Server response

clearCache() 공개 메소드

Clears the cache of an index.
public clearCache ( ) : Response
리턴 Response Response object

close() 공개 메소드

Closes the index.
public close ( ) : Response
리턴 Response Response object

count() 공개 메소드

Counts results of query.
또한 보기: Elastica\SearchableInterface::count
public count ( string | array | Query $query = '' ) : integer
$query string | array | Query Array with all query data inside or a Elastica\Query object
리턴 integer number of documents matching the query

create() 공개 메소드

Creates a new index with the given arguments.
public create ( array $args = [], boolean | array $options = null ) : Response
$args array OPTIONAL Arguments to use
$options boolean | array OPTIONAL bool=> Deletes index first if already exists (default = false). array => Associative array of options (option=>value)
리턴 Response Server response

createSearch() 공개 메소드

public createSearch ( string | array | Query $query = '', integer | array $options = null, Elastica\ResultSet\BuilderInterface $builder = null ) : Search
$query string | array | Query
$options integer | array
$builder Elastica\ResultSet\BuilderInterface
리턴 Search

delete() 공개 메소드

Deletes the index.
public delete ( ) : Response
리턴 Response Response object

deleteByQuery() 공개 메소드

Deletes entries in the db based on a query.
public deleteByQuery ( Query | string | array $query, array $options = [] ) : Response
$query Query | string | array Query object or array
$options array Optional params
리턴 Response

deleteDocuments() 공개 메소드

Uses _bulk to delete documents from the server.
public deleteDocuments ( array $docs ) : ResponseSet
$docs array Array of Elastica\Document
리턴 Elastica\Bulk\ResponseSet

exists() 공개 메소드

Checks if the given index is already created.
public exists ( ) : boolean
리턴 boolean True if index exists

flush() 공개 메소드

Flushes the index to storage.
public flush ( $options = [] ) : Response
리턴 Response Response object

forcemerge() 공개 메소드

Detailed arguments can be found here in the link
public forcemerge ( array $args = [] ) : array
$args array OPTIONAL Additional arguments
리턴 array Server response

getAliases() 공개 메소드

Returns all index aliases.
public getAliases ( ) : array
리턴 array Aliases

getClient() 공개 메소드

Returns index client.
public getClient ( ) : Client
리턴 Client Index client object

getMapping() 공개 메소드

Gets all the type mappings for an index.
public getMapping ( ) : array
리턴 array

getName() 공개 메소드

Returns the index name.
public getName ( ) : string
리턴 string Index name

getSettings() 공개 메소드

Returns the index settings object.
public getSettings ( ) : Settings
리턴 Elastica\Index\Settings Settings object

getStats() 공개 메소드

Return Index Stats.
public getStats ( ) : Stats
리턴 Elastica\Index\Stats

getType() 공개 메소드

Returns a type object for the current index with the given name.
public getType ( string $type ) : Type
$type string Type name
리턴 Type Type object

hasAlias() 공개 메소드

Checks if the index has the given alias.
public hasAlias ( string $name ) : boolean
$name string Alias name
리턴 boolean

open() 공개 메소드

Opens an index.
public open ( ) : Response
리턴 Response Response object

optimize() 공개 메소드

Detailed arguments can be found here in the link
public optimize ( array $args = [] ) : array
$args array OPTIONAL Additional arguments
리턴 array Server response

refresh() 공개 메소드

Refreshes the index.
public refresh ( ) : Response
리턴 Response Response object

removeAlias() 공개 메소드

Removes an alias pointing to the current index.
public removeAlias ( string $name ) : Response
$name string Alias name
리턴 Response Response

request() 공개 메소드

Makes calls to the elasticsearch server based on this index.
public request ( string $path, string $method, array | string $data = [], array $query = [] ) : Response
$path string Path to call
$method string Rest method to use (GET, POST, DELETE, PUT)
$data array | string OPTIONAL Arguments as array or encoded string
$query array OPTIONAL Query params
리턴 Response Response object

setSettings() 공개 메소드

Can be used to change settings during runtime. One example is to use it for bulk updating.
public setSettings ( array $data ) : Response
$data array Data array
리턴 Response Response object

updateDocuments() 공개 메소드

Uses _bulk to send documents to the server.
public updateDocuments ( array $docs ) : ResponseSet
$docs array Array of Elastica\Document
리턴 Elastica\Bulk\ResponseSet

프로퍼티 상세

$_client 보호되어 있는 프로퍼티

Client object.
protected $_client

$_name 보호되어 있는 프로퍼티

Index name.
protected $_name