PHP 클래스 Elastica\Type

elasticsearch has for every types as a substructure. This object represents a type inside a context The hierarchy is as following: client -> index -> type -> document
저자: Nicolas Ruflin ([email protected])
상속: implements elastica\SearchableInterface
파일 보기 프로젝트 열기: ruflin/elastica 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_index Index.
$_name Type name.
$_serializer A callable that serializes an object passed to it

공개 메소드들

메소드 설명
__construct ( Index $index, string $name ) Creates a new type object inside the given index.
addDocument ( Document $doc ) : Response Adds the given document to the search index.
addDocuments ( array $docs ) : ResponseSet Uses _bulk to send documents to the server.
addObject ( $object, Document $doc = null ) : Response
addObjects ( array $objects ) : ResponseSet Uses _bulk to send documents to the server.
count ( string | array | Query $query = '' ) : integer Count docs by query.
createDocument ( string $id = '', array | string $data = [] ) : Document
createSearch ( string | array | Query $query = '', integer | array $options = null, Elastica\ResultSet\BuilderInterface $builder = null ) : Search Create search object.
deleteById ( integer | string $id, array $options = [] ) : Response Deletes an entry by its unique identifier.
deleteByQuery ( Query | string $query, array $options = [] ) : Response Deletes entries in the db based on a query.
deleteDocument ( Document $document ) : Response
deleteDocuments ( array $docs ) : ResponseSet Uses _bulk to delete documents from the server.
deleteIds ( array $ids, string | boolean $routing = false ) : Response Deletes the given list of ids from this type.
exists ( ) : boolean Checks if the given type exists in Index.
getDocument ( string $id, array $options = [] ) : Document Get the document from search index.
getIndex ( ) : Index Returns index client.
getMapping ( ) : array Returns current mapping for the given type.
getName ( ) : string Returns the type name.
request ( string $path, string $method, array $data = [], array $query = [] ) : Response Makes calls to the elasticsearch server based on this type.
search ( string | array | Query $query = '', integer | array $options = null ) : ResultSet Do a search on this type.
setMapping ( Mapping | array $mapping ) : Response Sets value type mapping for this type.
setSerializer ( array | string $serializer ) Sets the serializer callable used in addObject.
updateDocument ( Document | Elastica\Script\AbstractScript $data, array $options = [] ) : Response Update document, using update script. Requires elasticsearch >= 0.19.0.
updateDocuments ( array $docs ) : ResponseSet Uses _bulk to send documents to the server.

메소드 상세

__construct() 공개 메소드

Creates a new type object inside the given index.
public __construct ( Index $index, string $name )
$index Index Index Object
$name string Type name

addDocument() 공개 메소드

Adds the given document to the search index.
public addDocument ( Document $doc ) : Response
$doc Document Document with data
리턴 Response

addDocuments() 공개 메소드

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

addObject() 공개 메소드

public addObject ( $object, Document $doc = null ) : Response
$object
$doc Document
리턴 Response

addObjects() 공개 메소드

Uses _bulk to send documents to the server.
public addObjects ( array $objects ) : ResponseSet
$objects array
리턴 Elastica\Bulk\ResponseSet

count() 공개 메소드

Count docs by 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

createDocument() 공개 메소드

public createDocument ( string $id = '', array | string $data = [] ) : Document
$id string
$data array | string
리턴 Document

createSearch() 공개 메소드

Create search object.
public createSearch ( string | array | Query $query = '', integer | array $options = null, Elastica\ResultSet\BuilderInterface $builder = null ) : Search
$query string | array | Query Array with all query data inside or a Elastica\Query object
$options integer | array OPTIONAL Limit or associative array of options (option=>value)
$builder Elastica\ResultSet\BuilderInterface
리턴 Search

deleteById() 공개 메소드

Deletes an entry by its unique identifier.
public deleteById ( integer | string $id, array $options = [] ) : Response
$id integer | string Document id
$options array
리턴 Response Response object

deleteByQuery() 공개 메소드

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

deleteDocument() 공개 메소드

public deleteDocument ( Document $document ) : Response
$document Document
리턴 Response

deleteDocuments() 공개 메소드

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

deleteIds() 공개 메소드

Deletes the given list of ids from this type.
public deleteIds ( array $ids, string | boolean $routing = false ) : Response
$ids array
$routing string | boolean Optional routing key for all ids
리턴 Response Response object

exists() 공개 메소드

Checks if the given type exists in Index.
public exists ( ) : boolean
리턴 boolean True if type exists

getDocument() 공개 메소드

Get the document from search index.
public getDocument ( string $id, array $options = [] ) : Document
$id string Document id
$options array Options for the get request.
리턴 Document

getIndex() 공개 메소드

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

getMapping() 공개 메소드

Returns current mapping for the given type.
public getMapping ( ) : array
리턴 array Current mapping

getName() 공개 메소드

Returns the type name.
public getName ( ) : string
리턴 string Type name

request() 공개 메소드

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

setMapping() 공개 메소드

Sets value type mapping for this type.
public setMapping ( Mapping | array $mapping ) : Response
$mapping Elastica\Type\Mapping | array Elastica\Type\MappingType object or property array with all mappings
리턴 Response

setSerializer() 공개 메소드

Sets the serializer callable used in addObject.
또한 보기: Elastica\Type::addObject
public setSerializer ( array | string $serializer )
$serializer array | string @see \Elastica\Type::_serializer

updateDocument() 공개 메소드

Update document, using update script. Requires elasticsearch >= 0.19.0.
public updateDocument ( Document | Elastica\Script\AbstractScript $data, array $options = [] ) : Response
$data Document | Elastica\Script\AbstractScript Document with update data
$options array array of query params to use for query. For possible options check es api
리턴 Response

updateDocuments() 공개 메소드

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

프로퍼티 상세

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

Index.
protected $_index

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

Type name.
protected $_name

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

A callable that serializes an object passed to it
protected $_serializer