Download the PHP package legalthings/elasticsearch-php without Composer
On this page you can find all versions of the php package legalthings/elasticsearch-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package elasticsearch-php
Legal Things - Elasticsearch PHP
This library aims to provide you with a simplified interface to use Elasticsearch. Internally it uses the original elastic/elasticsearch-php library.
The client of the original library is exposed and can be used if needed.
Requirements
- PHP >= 5.6.0
- Elasticsearch ~5.3.0
Required PHP extensions are marked by composer
Installation
The library can be installed using composer.
composer require legalthings/elasticsearch-php
Client
To create a client you need to pass configuration options.
If no options are given, localhost:9200
is automatically used as the host.
You can use the original elastic/elasticsearch-php client directly if you need its functionality.
Configuration
Configuration is passed to Elasticsearch's configuration builder, which means you can provide any configuration options that it accepts. See this link for more information.
Add ["quiet" => true]
to the config if you want to add custom keys to the configuration.
If quiet isn't provided, Elasticsearch will throw an exception if it encounters keys unrelated to the Elasticsearch client.
Search
The search()
method is used to perform common, basic search operations in Elasticsearch.
The method automatically transforms filters and text searches to the correct Elasticsearch equivalent, so you don't have to do that manually.
Index
The index()
method is used to perform common, basic index operations in Elasticsearch
Update
The update()
method is used to perform common, basic update operations in Elasticsearch, which partially updates a document
Get
The get()
method is used to perform common, basic get operations in Elasticsearch.
Delete
The delete()
method is used to perform common, basic delete operations in Elasticsearch.
Filters
This library makes it easy to filter for data in Elasicsearch, because you don't have to transform the filter in a specific structure. See the tests for more examples. See jasny filter for more information about the syntax.
Alternatively the filter can be composed using a fluent interface. This will output the same query as the example above.
Mapping
The library comes with predefined Elasticsearch mappings that you can use. See this file for more maps.