elasticsearch-php | Official PHP client for Elasticsearch | Continuous Deployment library
kandi X-RAY | elasticsearch-php Summary
kandi X-RAY | elasticsearch-php Summary
[Total Downloads] Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because of this it tries to be opinion-free and very extendable. To maintain consistency across all the low-level clients (Ruby, Python, etc.), clients accept simple associative arrays as parameters. All parameters, from the URI to the document body, are defined in the associative array. Starting from version 7.4.0, all the endpoints (and namespaces) are autogenerated using the [util/GenerateEndpoints.php] script. This script reads the [Elasticsearch API specs] and generates the PHP classes for all the endpoints.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of elasticsearch-php
elasticsearch-php Key Features
elasticsearch-php Examples and Code Snippets
Community Discussions
Trending Discussions on elasticsearch-php
QUESTION
I am trying to make a simple HTTP GET request to query Elasticsearch. The Elasticsearch syntax allow the use of a request body in a GET request to add addition query options. I am using the PHP function file_get_contents() to make the GET request.
The problem is that file_get_contents() seems to be ignoring the body of the request when making a GET request yet it works fine when using a POST request instead.
How can I get file_get_contents() to process the body of the GET request correctly? The code I am using is shown below.
Note that :
- I want to use file_get_contents() to do this, NOT php cURL, php Request2, or the elasticsearch-php library
- I would like to keep this as a GET request, changing it to a POST request instead is not what I am after
Thanks in advance!
...ANSWER
Answered 2021-Mar-12 at 21:38Does it work, if you use http
instead of https
as key name in $context
?
QUESTION
I have a Docker container with ElasticSearch and when I go to localhost: 9200 I see the following
...ANSWER
Answered 2021-Feb-07 at 05:47This issue is due to running docker containers, which have their own networs. Localhost would not work and instead you should create a network which both the conatiner should use, that way lavarel container would be able to connect to ES conatiner.
QUESTION
I am using elasticsearch-php in a laravel project.
I have a products
table like below
ANSWER
Answered 2020-Aug-09 at 09:17I can see you have the language identifier in your database as en-us
, zh-cn
which means before storing the title, you know the language of product, than you can simply use the multi-field and can add a new language sub-field for all the available languages in Elasticsearch.
You can have a look at all the current supported languages in Elasticsearch and add all the sub-fields in beginning or change the mapping and add a new language sub-field as you get it in your system.
QUESTION
Does anyone know a good resource with elasticsearch-php examples ideally covering queries taking MySQL Examples. I am struggling both with the code syntax and what to use when.
For example, I want to do a search where $name must be part of field 'business' and where 'country' matches $country
...ANSWER
Answered 2020-Mar-04 at 10:44You can only have a single must
in a bool
query, then all must constraints must be elements of the must
array. Try like this instead:
QUESTION
I use elasticsearch-php in my laravel app with XAMPP.
Versions:
- PHP: 7.3
- Laravel: ^6.2
- Elasticsearch: ^7.6
AppServiceProvider.php
code where I register my custom scout driver:
ANSWER
Answered 2020-Mar-02 at 11:31First of all, DON’T PANIC :) I think what you don't have Elasticsearch installed. It will take 5 minutes to install Elasticsearch and solve your problem.
Installation
- Download and unpack the Elasticsearch official distribution.
- Run
bin/elasticsearch
on Linux or macOS. Runbin\elasticsearch.bat
on Windows. - Run
curl -X GET http://localhost:9200
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install elasticsearch-php
Add elasticsearch/elasticsearch as a dependency in your project’s composer.json file (change version to suit your version of Elasticsearch, for instance for ES 7.0): ```json { "require": { "elasticsearch/elasticsearch": "^7.0" } } ```
Download and install Composer: ```bash curl -s http://getcomposer.org/installer | php ```
Install your dependencies: ```bash php composer.phar install ```
Require Composer’s autoloader Composer also prepares an autoload file that's capable of autoloading all the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process: ```php <?php use Elasticsearch\ClientBuilder; require 'vendor/autoload.php'; $client = ClientBuilder::create()->build(); ```
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page