Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch 8.x Support #18

Merged
merged 23 commits into from
Mar 25, 2022
Merged

Conversation

hkulekci
Copy link

Here is a PR for Elasticsearch 8.x support. You can check my notes from hkulekci#2 this pull request.

@hkulekci
Copy link
Author

hkulekci commented Feb 27, 2022

I think we need to change the base branch of this PR. please notify me if necessary.

@hkulekci
Copy link
Author

hkulekci commented Mar 2, 2022

/ping @alexander-schranz

@alexander-schranz alexander-schranz changed the base branch from 7.x to 8.x March 2, 2022 11:55
}
],
"require": {
"php": "^7.1|^8.0",
"php": "^7.4 || ^8.0",
"symfony/serializer": "^2.8 || ^3.4 || ^4.0 || ^5.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did write that Symfony 4.4 is not longer supported then we should adjust it here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I could not be sure about this version matrix. Let me think about it a little bit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can also allow and test against symfony ^6.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also need to discuss it internal if we need to support Elasticsearch 8 for Symfony 3.4 because of @sulu ArticleBundle 1.2 Version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Let me know the decision of the internal discussion. As I see on my local test, all the versions are working, but I could not test with full Symfony, and I rely on tests.

Copy link
Member

@alexander-schranz alexander-schranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hkulekci Nice work 👍 , didnt here about it that Elasticsearch 8 is released.

@alexander-schranz alexander-schranz added the enhancement New feature or request label Mar 2, 2022
@hkulekci
Copy link
Author

hkulekci commented Mar 2, 2022

👍 technology is going fast :D Most of the time we are missing it.

@hkulekci
Copy link
Author

hkulekci commented Mar 6, 2022

Before merging this, we need to check the tests again. After dev releases, there are some BC changes on alpha release. https://github.com/elastic/elasticsearch-php/releases/tag/v8.0.0-alpha. Let me check the PR again for BC changes.

@hkulekci
Copy link
Author

hkulekci commented Mar 6, 2022

As I see, there are some problems related to the elastic/transport library for the alpha release, and it is not stable to use it yet. But I tested with the 8.x-dev release, and it is working clearly. Our changes will be valid for the stable release, but we need to make other changes related to namespacing when the stable 8.x version is published. I tested with 8.0.0-alpha release, and I got the below errors :

1) ONGR\ElasticsearchDSL\Tests\Functional\Aggregation\DateHistogramAggregationTest::testDateHistogramWithMinuteCalendarInterval
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

2) ONGR\ElasticsearchDSL\Tests\Functional\Aggregation\DateHistogramAggregationTest::testDateHistogramWithMonthCalendarInterval
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

3) ONGR\ElasticsearchDSL\Tests\Functional\Aggregation\DateHistogramAggregationTest::testDateHistogramWitMinuteFixedInterval
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

4) ONGR\ElasticsearchDSL\Tests\Functional\Query\FunctionScoreQueryTest::testRandomScore
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

5) ONGR\ElasticsearchDSL\Tests\Functional\Query\FunctionScoreQueryTest::testScriptScore
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

6) ONGR\ElasticsearchDSL\Tests\Functional\Query\MatchAllQueryTest::testMatchAll
Error: Call to undefined method Elastic\Transport\Transport::setRetries()

/Volumes/webroot/github/ElasticsearchDSL/vendor/elasticsearch/elasticsearch/src/ClientBuilder.php:330
/Volumes/webroot/github/ElasticsearchDSL/tests/Functional/AbstractElasticsearchTestCase.php:38

ERRORS!
Tests: 255, Assertions: 314, Errors: 6.

These are related to inconsistency between elasticsearch/elasticsearch:8.0.0-alpha and elastic/transport:8.0.0-rc3 libraries.

So, what I am trying to suggest. We can continue with 8.x-dev release for now, and we can do another iteration for stable version support after the stable version is published. We are waiting here to support for ES 8.x in this library.

/ping @alexander-schranz

@hkulekci
Copy link
Author

Do we have any update here? @alexander-schranz

@alexander-schranz
Copy link
Member

hello @hkulekci,

These are related to inconsistency between elasticsearch/elasticsearch:8.0.0-alpha and elastic/transport:8.0.0-rc3 libraries.

Looks like they released already some RC releases. for the elasticsearch-php. I think I would wait with merging and tagging a 8.0 release until the final stable version of https://github.com/elastic/elasticsearch-php 8.0 is released. Would that block something on your side?

@hkulekci
Copy link
Author

@alexander-schranz, I see. I am just an adventurer here ^_^. There is no blocker for me. Some users of https://github.com/matchish/laravel-scout-elasticsearch library request ES8 support and, I start the journey to help the community. As I know, the users have a solution; they can use repository aliasing if anybody wants to use my repository as 8.x. Let's wait for the stable version if anybody has a blocker. Thanks for your time.

@alexander-schranz
Copy link
Member

Looks like we got a stable release now: https://github.com/elastic/elasticsearch-php/releases/tag/v8.0.0 🎉 do you want to rebase the branch and check if all works like expected?

@hkulekci
Copy link
Author

Sure. Let me give me some time to check the result.

@hkulekci
Copy link
Author

I just changed the namespace and executeSearch() method response. I think this is enough.

@hkulekci
Copy link
Author

The repository trying to fetch v8.x-dev version because of "minimum-stability": "dev" configuration of the composer.json. So, the current tests are failing when I choose the requirement as "elasticsearch/elasticsearch": "^8.0.0". I was try to select a direct version instead of a semantic one as "elasticsearch/elasticsearch": "8.0.0", in this case, we are getting an error because of composer validation composer validate --strict. I think we need to choose one of them. @alexander-schranz

@alexander-schranz
Copy link
Member

alexander-schranz commented Mar 25, 2022

Looks like they created a 8.1 branch which is not up2date with 8.0 changes: elastic/elasticsearch-php#1204

You can could currently go with 8.0.* in the composer.json.

composer.json Outdated Show resolved Hide resolved
@alexander-schranz
Copy link
Member

To run the tests we need a psr18 client implementation I added the same as elasticsearch is using for there tests.

@hkulekci
Copy link
Author

hkulekci commented Mar 25, 2022

I was trying to solve this on another branch on my repository. I think you have already solved it nicely. 👍

hkulekci#3

@alexander-schranz alexander-schranz merged commit 86e37b5 into handcraftedinthealps:8.x Mar 25, 2022
@alexander-schranz
Copy link
Member

@hkulekci thank you for all your work. Great Job 👍 I tagged a RC version: https://github.com/handcraftedinthealps/ElasticsearchDSL/releases/tag/8.0.0-RC1

@hkulekci
Copy link
Author

Hey @alexander-schranz thanks for the patience of this long conversation :) 💯

@alexander-schranz
Copy link
Member

Was a pleasure to help here and happy for everybody who try to contribute something :)

@alexander-schranz
Copy link
Member

We tagged a stable 8.0.0 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants