elastically
elastically copied to clipboard
Plan to use `ruflin/elastica` version 8?
Hi,
First of all thank you for this library :-)
I am wondering if it is planned to use version 8 of ruflin/elastica, and if so when more or less?
Many thanks
We would be happy to see Pull Request about this yes. Can you work on this?
Some difficulties could arise:
- the connections pool is now based on Elasticsearch custom https://github.com/elastic/elastic-transport-php - so our Symfony HttpClient bridge must probably be changed;
- it will probably stop working with OpenSearch, see https://github.com/elastic/elasticsearch-php/issues/1347 (not tested)
I would love for our project to be compatible with both 7 and 8.
Thank you @damienalexandre for your quick feedback! Sure I can invest some time to try & contribute :slightly_smiling_face:
also I forgot to mention that I am not sure if we can make it work with both versions, as the namespace for different classes (e.g. Client) has changed between 7 and 8.
The 8.0.0 version is now released https://github.com/ruflin/Elastica/releases/tag/8.0.0
Thanks @VincentLanglet for the update!
@damienalexandre so I started to work on it and now I get following error message for many of the PhpUnit tests:
Elastic\Transport\Exception\NoNodeAvailableException: Exceeded maximum number of retries (1)
I am missing anything, should I set some environment/configuration value?
The tests are running against a real Elasticsearch.
You can run this:
make start
make test
make stop
It will boot a ES node via Docker and expose port 9999 (we don't use the default 9200 port to avoid touching any real Elasticsearch node you may have on your computer).
I had actually tried to start the docker ES node as I saw the makefile, however I still get exactly the same error message :disappointed: any other idea?
hi @damienalexandre so I tried once again to make this work without success, would you have any other hint?
Could you show the console output?
Can you run docker ps?
sure, here it is:
console output (just an extract)
docker ps
Can you open http://127.0.0.1:9999/ in a browser?
What does curl http://127.0.0.1:9999/ get you?
This is what I get when opening this in a browser:
And with curl (essentially the same):
I don't know what's happening but:
- you have a working php
- you have a working elasticsearch
Is there something we don't know? Do you have a proxy?
Can you go to http://127.0.0.1:9999/_cluster/health?pretty and paste the result?
Thanks for taking the time to help :pray:
Here is the outcome of that URL:
{
"cluster_name": "docker-cluster",
"status": "green",
"timed_out": false,
"number_of_nodes": 1,
"number_of_data_nodes": 1,
"active_primary_shards": 0,
"active_shards": 0,
"relocating_shards": 0,
"initializing_shards": 0,
"unassigned_shards": 0,
"delayed_unassigned_shards": 0,
"number_of_pending_tasks": 0,
"number_of_in_flight_fetch": 0,
"task_max_waiting_in_queue_millis": 0,
"active_shards_percent_as_number": 100
}
Status green, it should work!
You test from "master" or with your updated dependencies? It looks like the Elastica client is not properly configured, that may be a regression from version 8.
aaah got it, it is indeed an issue from version 8! I reverted my changes and it works fine :tada: alright then, I need to investigate further :sweat_smile: thanks again so much for your support :pray:
ps: if anyone sees this and wants to help too, please do :slightly_smiling_face:
FYI elastic/elasticsearch-php 8.0 is no more compatible with alternative servers like opensearch.
There is a mechanism that checks the headers https://github.com/elastic/elasticsearch-php/issues/1229
thanks @jderusse I have actually also just noticed the same while trying to run the tests with elasticsearch without updating the docker image :+1:
@damienalexandre I am making some progress, now some more tests are green :tada:
short update, now I have all tests green besides the one for the HttpClientTransport where I might need some help - I'll do as much as I can :slightly_smiling_face:
Hi @jmariller ! Are you still working on this? Maybe I can help on the HttpClientTransport issue
hi @GaryPEGEOT! no, at the moment I do not have capacity unfortunately. So if you could help it would be great - you can check out my PR and work directly on it if you want :slightly_smiling_face: thanks!
Hi @damienalexandre!
Correct me if I'm wrong, but it looks like JoliCode\Elastically\Transport\HttpClientTransport will not have much sense with ruflin's Elastica v8:
- AbstractTransport is gone
Elastic\Transport\Transportis a final class
And maybe more importantly, we don't really need it anymore, as you can specify $config['transport_config']['http_client'] directly, and provide it with your own Symfony\Component\HttpClient\Psr18Client.
We could update ElasticallyExtension so that given a client it automatically create the PSR client.
You are absolutely right, and what you suggest looks good, thanks :+1:
I'm creating a PR on damien's fork to remove the transport while adding test to make sure you can specify your own PSR Compliant client if you want to. This will be a BC break tho, so I guess we need to target a new branch like next instead of master?
This can be shipped as a new major Elastically version. Can we make sure update the documentation as well?
Done in https://github.com/jmariller/elastically/pull/1
I'm creating a PR on damien's fork
Wouldn't it better to do it directly on this repo ?
~~It would, but I had to fork jmariller fork to get his changes. Not sure if can make a PR from a fork of a fork~~ Nevermind, I created a separate PR
I have some clean up to do before a release. For example we must remove OpenSearch from supported products :disappointed:
Version 2.0 of Elastically, with Elastica 8, is now available! Thanks everyone!