shift31 / laravel-elasticsearch Goto Github PK
View Code? Open in Web Editor NEWElasticsearch for Laravel
License: MIT License
Elasticsearch for Laravel
License: MIT License
How to pass in User and password for remote elastiscsearch server connections?
For some reason al lthe elasticsearch/src/Elasticsearch/Common/Exceptions arent loaded into laravel giving 500 errors instead of ES errors
In your readme you give the following example for using the Es client through a facade:
$result = Es::search($searchParams);
In Laravel 5 this only works when you add a use declaration at the top:
use Shift31\LaravelElasticsearch\Facades\Es
Or by adding a backslash to the facade:
$result = \Es::search($searchParams);
Working with Lumen Framework, trying to register laravel-elasticsearch in bootstrap/app.php with:
$app->register(\Shift31\LaravelElasticsearch\ElasticsearchServiceProvider::class);
throws this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Laravel\Lumen\Application::booting()
Error: ErrorException array_merge(): Argument #2 is not an array
Code Line: $params = array_merge($connParams, Config::get('elasticsearch'));
File: ../Shift31/LaravelElasticsearch/LaravelElasticsearchServiceProvider.php
ElasticSearch version: 1.0.1
Laravel: newest version
my elasticsearch.php provider (tried adding commas after each element, didnt have any effect)
return array(
'hosts' => array(
'localhost:9200'
),
'logPath' => '/var/log/elasticsearch/elasticsearch.log'
'logLevel' => Logger::INFO;
);
My routes.php entry for the sake of completeness. error doesnt seem to be related to this.
Route::get('/', function() {
$params['index'] = 'movies';
$params['type'] = 'movie';
$params['body']['query']['match']['title'] = 'cop';
$result = Es::search($params);
return $result;
});
Hi guys, have you used this plugin yourself in production environment?
Hi, are you planning to add support for 5.x version of ES?
I think adding the support on the composer file would do. I've been testing with the 5.0 version of elasticsearch/elasticsearch
and everything seems to work. Shall I make a PR?
Is there any support for ES update, or maybe i'm not using it's the right way,
right here https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-updates.html
i found a script way to increment value without making any select to get actual value, yet when i tried use it as params i get error like this
{"error":"MapperParsingException[object mapping for [event] tried to parse field [script] as object, but got EOF, has a concrete value been provided to it?]","status":400}
is there any way to use Es::update($params); to increment some value ?
The ~2.0 release is completely broken at this moment. Since this package has some popularity and featured by official, you should not merge #19, #24 and #25 and tag new release without testing.
More info on official doc:
https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_breaking_changes_from_1_x.html
https://www.elastic.co/guide/en/elasticsearch/client/php-api/2.0/_configuration.html
Does the package support mapping as explained in https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html#_example_mapping ?
Hello.
Do you have a simple example of how to update a document data using the function update, ate the "Client.php" file? I need to set a new field on my document e update others. Thank you.
Hi,
Just installed via composer which gave me the following warnings/errors:
Package guzzle/common is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/stream is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/parser is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Package guzzle/http is abandoned, you should avoid using it. Use guzzle/guzzle instead.
Is it possible to switch to guzzle/guzzle?
Hello @bgetsug ,
Really thank you very much. I really much existed when I see this package. Actually, before Laravel I am working with symfony2. It also have a good Package for Elastica Search
Which is well documented. So I just request you to please describe a little bit more, like where we need to put the configuration related to the index. where we need to declare indexes how to attach with model and all.
As I attached the link of Symfony bundle So that we can have the idea exactly how can we also integrate this Good Package in Laravel.
Thank you.
I noticed that there is no license attached to this library. May i suggest licensing it under the MIT license and dropping a LICENSE.md
file in the repo with a copy?
https://opensource.org/licenses/MIT has a good copy.
This could have been a pull request but it is more appropriate for the original author to explicitly state the license under which the code is released.
Trying to run php artisan config:cache
on a project with this package installed fails because commit 10c3a1f introduced a not serializable value on the config file. The logger is now created on the config file instead of on the Service Provider.
Unless you have a very good reason for this, I can make a PR moving that code back to the service provider and restoring the logPath
and logLevel
on the config file. I guess I could make it backwards compatible that only if you don't have the logger on the config file it gets created on the service provider.
Let me know what you think.
Hi,
I try to use your Service Provider with my fresh install of Laravel 5.1 but i have some problems with composer :
1° "guzzle/guzzle suggests installing guzzlehttp/guzzle (Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated.)"
2° "Your requirements could not be resolved to an installable set of packages."
Problem 1
- Conclusion: remove laravel/framework v5.1.2
- Conclusion: don't install laravel/framework v5.1.2
- Installation request for shift31/laravel-elasticsearch 1.0.@dev -> satisfiable by shift31/laravel-elasticsearch[1.0.x-dev].
- Conclusion: don't install laravel/framework v5.1.1
- Conclusion: don't install laravel/framework v5.1.0
- shift31/laravel-elasticsearch 1.0.x-dev requires illuminate/support ~4 -> satisfiable by illuminate/support[4.0.x-dev, 4.1.x-dev, 4.2.x-dev, v4.0.0, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.1, v4.0.10, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.13, v4.1.14, v4.1.15, v4.1.16, v4.1.17, v4.1.18, v4.1.19, v4.1.2, v4.1.20, v4.1.21, v4.1.22, v4.1.23, v4.1.24, v4.1.25, v4.1.26, v4.1.27, v4.1.28, v4.1.29, v4.1.3, v4.1.30, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0-BETA1, v4.2.1, v4.2.12, v4.2.16, v4.2.17, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
- don't install illuminate/support 4.0.x-dev|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support 4.1.x-dev|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support 4.2.x-dev|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.0|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.0-BETA2|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.0-BETA3|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.0-BETA4|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.1|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.10|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.2|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.3|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.4|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.5|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.6|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.7|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.8|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.0.9|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.0|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.1|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.10|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.11|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.12|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.13|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.14|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.15|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.16|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.17|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.18|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.19|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.2|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.20|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.21|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.22|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.23|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.24|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.25|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.26|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.27|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.28|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.29|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.3|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.30|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.4|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.5|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.6|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.7|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.8|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.1.9|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.0-BETA1|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.1|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.12|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.16|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.17|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.2|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.3|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.4|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.5|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.6|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.7|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.8|don't install laravel/framework 5.1.x-dev
- don't install illuminate/support v4.2.9|don't install laravel/framework 5.1.x-dev
- Installation request for laravel/framework 5.1. -> satisfiable by laravel/framework[5.1.x-dev, v5.1.0, v5.1.1, v5.1.2].
Is that just me or... ?
Thanks for your help,
Hello,
I'm trying to use Laravel-elasticsearch for ES1.x with PHP7 support. So I've added 4.1.* as version.
composer require shift31/laravel-elasticsearch:4.1.*
However, when it starts to install, I get an error like this:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- shift31/laravel-elasticsearch v4.1.1 requires php >=5.4.0 <=7.0 -> your PHP version (7.0.15) does not satisfy that requirement.
- shift31/laravel-elasticsearch v4.1.0 requires php >=5.4.0 <=7.0.0 -> your PHP version (7.0.15) does not satisfy that requirement.
- Installation request for shift31/laravel-elasticsearch 4.1.* -> satisfiable by shift31/laravel-elasticsearch[v4.1.0, v4.1.1].
So, I'm stuck here. Since Laravel 4.2.20, Laravel 4 can run on PHP7.
I'd appreciate if this could be resolved.
Thanks in advance!
Recently elastic search was update to 1.0, I have modified the composer.json file in your package to point to the elastic-search php client v1.0. the problem is that when I do a composer update it does not update the version.
App/config/app.php
in providers
Class 'Shift31\LaravelElasticsearch\ElasticsearchServiceProvider' not found
Composer.json
"shift31/laravel-elasticsearch": "~0.4"
Shift31/laravel-elasticsearch
5.x versions are mentioned in the README.md
version matrix table but those versions do not exist.
https://packagist.org/packages/shift31/laravel-elasticsearch
Hi,
could you modify the composer.json file so this package can be used in Laravel 5?
Hello again! we are having issues with Scroll. I've pasted the output below. If we manually take that generated URL and use curl on it, we see the data results. ANY help would be amazing!
[Elasticsearch\Common\Exceptions\Missing404Exception]
{"_scroll_id":"c2NhbjswOzE7dG90YWxfaGl0czo2MjIxOw==","took":11,"timed_out":false,"_shards":{"total":5,"successful":0,"failed":5,"failures":
[{"status":404,"reason":"SearchContextMissingException[No search context found for id [216741]]"},{"status":404,"reason":"SearchContextMiss
ingException[No search context found for id [216743]]"},{"status":404,"reason":"SearchContextMissingException[No search context found for i
d [216745]]"},{"status":404,"reason":"SearchContextMissingException[No search context found for id [216742]]"},{"status":404,"reason":"Sear
chContextMissingException[No search context found for id [216744]]"}]},"hits":{"total":6221,"max_score":0.0,"hits":[]}}
[Guzzle\Http\Exception\ClientErrorResponseException]
Client error response
[status code] 404
[reason phrase] Not Found
[url] http://10.0.1.223:9200/_search/scroll/c2Nhbjs1OzIxNjc0MTpZYVNkLXBwd1FGYTY5aWZaZkt5TlVROzIxNjc0MzpZYVNkLXBwd1FGYTY5aWZaZkt5TlVROzIxNjc
0NTpZYVNkLXBwd1FGYTY5aWZaZkt5TlVROzIxNjc0MjpZYVNkLXBwd1FGYTY5aWZaZkt5TlVROzIxNjc0NDpZYVNkLXBwd1FGYTY5aWZaZkt5TlVROzE7dG90YWxfaGl0czo2MjIxOw
==?scroll=1m
Where I can see how to add to index using Laravel 5, for example?
Hey,
Thanks for your hard work! Do you have plans on supporting php 7.1+ at some point? Would love to continue using this package, but 4.5 is broken now w/ 7.1.3 ;[
`
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for shift31/laravel-elasticsearch 4.5.0 -> satisfiable by shift31/laravel-elasticsearch[v4.5.0].
- shift31/laravel-elasticsearch v4.5.0 requires php >=5.6 <=7.1 -> your PHP version (7.1.3) does not satisfy that requirement.
Installation failed, reverting ./composer.json to its original content.
`
Hello, Can you please provide pagination example ? The doc you have provided is very short. Many things you should provide in that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.