include/SugarSearchEngine/Elastic/Elastica/Document.php
Single document stored in elastic search
- Author
- Nicolas Ruflin
- Category
- Xodoa
- Package
- Elastica
\Elastica_Document
Single document stored in elastic search
- Author
- Nicolas Ruflin
- Category
- Xodoa
Properties
Methods
__construct(
int $id
=
'', array $data
=
array(), string $type
=
'', string $index
=
''
)
:
void
Creates a new document
Name | Type | Description |
---|---|---|
$id | int | OPTIONAL $id Id is create if empty |
$data | array | OPTIONAL Data array |
$type | string | OPTIONAL Type name |
$index | string | OPTIONAL Index name |
add(
string $key, mixed $value
)
:
\Elastica_Document
Adds the given key/value pair to the document
Name | Type | Description |
---|---|---|
$key | string | Document entry key |
$value | mixed | Document entry value |
Type | Description |
---|---|
\Elastica_Document |
addFile(
string $key, string $filepath, string $mimeType
=
''
)
:
\Elastica_Document
Adds a file to the index
To use this feature you have to call the following command in the elasticsearch directory:
./bin/plugin install mapper-attachments
This installs the tika file analysis plugin. More infos about supported formats can be found here: {@link http://tika.apache.org/0.7/formats.html}
Name | Type | Description |
---|---|---|
$key | string | Key to add the file to |
$filepath | string | Path to add the file |
$mimeType | string | OPTIONAL Header mime type |
Type | Description |
---|---|
\Elastica_Document |
addFileContent(
string $key, string $content
)
:
\Elastica_Document
Name | Type | Description |
---|---|---|
$key | string | Document key |
$content | string | Raw file content |
Type | Description |
---|---|
\Elastica_Document |
addGeoPoint(
string $key, float $latitude, float $longitude
)
:
\Elastica_Document
Adds a geopoint to the document
Geohashes re not yet supported
Name | Type | Description |
---|---|---|
$key | string | Field key |
$latitude | float | Latitud value |
$longitude | float | Longitude value |
Type | Description |
---|---|
\Elastica_Document |
getIndex(
)
:
string
Type | Description |
---|---|
string | Index name |
Exception | Description |
---|---|
\Elastica_Exception_Invalid |
getParent(
)
:
string | int
Returns the parent document id
Type | Description |
---|---|
string | int | Parent document id |
getType(
)
:
string
Type | Description |
---|---|
string | Document type name |
Exception | Description |
---|---|
\Elastica_Exception_Invalid |
getVersion(
)
:
string | int
Returns document version
Type | Description |
---|---|
string | int | Document version |
setData(
array $data
)
:
\Elastica_Document
Overwrites the curent document data with the given data
Name | Type | Description |
---|---|---|
$data | array | Data array |
Type | Description |
---|---|
\Elastica_Document |
setIndex(
string $index
)
:
\Elastica_Document
Sets the document index name
Name | Type | Description |
---|---|---|
$index | string | Index name |
Type | Description |
---|---|
\Elastica_Document | Current object |
setOpType(
string $optype
)
:
\Elastica_Document
Set operation type
Name | Type | Description |
---|---|---|
$optype | string | Only accept create |
Type | Description |
---|---|
\Elastica_Document | Current object |
setParent(
string | int $parent
)
:
\Elastica_Document
Sets parent document id
Name | Type | Description |
---|---|---|
$parent | string | int | Parent document id |
Type | Description |
---|---|
\Elastica_Document | Current object |
setPercolate(
string $value
=
'*'
)
:
\Elastica_Document
Set percolate query param
Name | Type | Description |
---|---|---|
$value | string | percolator filter |
Type | Description |
---|---|
\Elastica_Document |
setTTL(
string $ttl
)
:
\Elastica_Document
Sets lifetime of document
Name | Type | Description |
---|---|---|
$ttl | string |
Type | Description |
---|---|
\Elastica_Document |
setType(
string $type
)
:
\Elastica_Document
Sets the document type name
Name | Type | Description |
---|---|---|
$type | string | Type name |
Type | Description |
---|---|
\Elastica_Document | Current object |
setVersion(
int $version
)
:
\Elastica_Document
Sets the version of a document for use with optimistic concurrency control
Name | Type | Description |
---|---|---|
$version | int | Document version |
Type | Description |
---|---|
\Elastica_Document | Current object |