-
Notifications
You must be signed in to change notification settings - Fork 730
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
Finalize elasticsearch 5 migration #1242
Conversation
@Tobion Thanks for taking this on. Can you ping me when I should have a look? |
@ruflin This should be ready now. Please have a look. The last piece I need to look at is the error parsing that seems to be a little strange at the moment (not giving as much info as possible). But identifying errors/success seems to work according to the tests. So I can do that in a separate PR. |
@Tobion Great work. Any chance you could update the CHANGELOG with some notes on the change? A summary as you have in the PR works for me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went quickly through the changes. In general LGTM, but there are some parts where we have bigger changes which could require a bit more discussions. Could you split up this PR into multiple smaller PR's very similar to the commits you already have?
For example one PR with all the docs cleanup, an other (or multiple) with removal of features which do not exist anymore and so on. All in all the outcome will be the same, but in case we have some more discussion for one part, it does not hold back the others.
Let me know if that works for you?
*/ | ||
protected $_data; | ||
|
||
/** | ||
* @param \Elastica\Document|\Elastica\Script\AbstractScript $document | ||
* @param Document|AbstractScript $document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does it know which is the correct path to Document
as it is in a different path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand the question. Elastica\Document
is already imported via use statement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question probably is, if phpdoc automatically also detects this. So I assume the answer is yes.
} catch (ResponseException $e) { | ||
// Table can't be deleted, because doesn't exist | ||
} | ||
if (is_bool($options) && $options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for myself: Need to check this in detail again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not $options === true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would work as well.
/** | ||
* Class GeohashCell. | ||
* | ||
* @link https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geohash-cell-query.html | ||
* @link https://www.elastic.co/guide/en/elasticsearch/reference/2.4/query-dsl-geohash-cell-query.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was removed in 5.0? If yes, we can also remove it here as it not work with 5.0 anyways, correct? But we should mention it in the changelog.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran the query against 5.0 and it didn't give an error. So I assume it was only removed by accident from the documentation and is only deprecated, just as geo_distance_range.
geo_distance_range and geohash_cell are deprecated in ES 5.0 and only work with indexes created in 2.x
The previous bad query now throws a syntax error from ES due to an invalid range option which makes the whole multi search fail instead of only a single search within the multi search. So I replaced it with a different kind of error that only fails for this single search
…been). So this feature has always been useless but ES 5 now validates the wrong param. Creating aliases has the possibility to specify routing and a filter. But the alastica api doesn't provide those params yet, which could be added in the future
ScriptId is used to reference stored scripts ("id" property has been renamed to "stored" in ES 5.1 which we need to do as well in later releases)
and deprecate null transport for transition to NullTransport just as Bool is deprecated in favor of BoolQuery
I added a detailed changelog and cleaned up some duplicated tests that have been forgotten to be removed when the filters got removed. I would really prefer not to split the PR because it would create alot of overhead and conflicts like in the changelog if I have to add each entry separately. If you have questions let me know. We can also have a skype call if you want to chat about something. |
Ok, let me try to review this PR in its entirety 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Tobion That is a great peace of work you create here. Thanks a lot for putting all the work into this. I left a minor comment.
When I merge this I plan to squash the commits into one and very soon afterwards to release 5.1.
*/ | ||
public function __construct(array $params = null, $id = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a BC break, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for the AbstractScript which also contains the language as well. But I don't think anyone implemented an own subclass. The existing subclasses like ScriptFile still have the same constructor. So I don't think anyone is affected by this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also assume that everyone that used it hopefully contributed it back to Elastica. For completeness I would still like to mention it under breaking changes. That doesn't mean I will not create 5.1 out of it ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -128,11 +128,6 @@ protected function _createIndex($name = null, $delete = true, $shards = 1) | |||
return $index; | |||
} | |||
|
|||
protected function _markSkipped50($message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AWESOME
|
||
class GeoDistanceRangeTest extends BaseTest | ||
class GeoDistanceRangeTest extends DeprecatedClassBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that idea.
@ruflin Do you not try to reflect the versioning of elastica with elasticsearch compatibility? So then the new version would be 5.0.1 and not 5.1 (on the other hand you might not want to add deprecations in a patch version release). I'd like to create another PR afterwards with some tiny changes to upgrade the dependency to elasticsearch 5.1 |
Yes I try to reflect compatibility. Is there anything inside which breaks with 5.1? All seems to also work with 5.2: #1245 If we do 5.1 I agree we should have elasticsearch first set to 5.1. |
There does not seem to be anything that breaks with 5.1. But the field to reference scripts by id has been renamed from So the only thing I'd like to do for 5.1 is to change this line: https://github.com/ruflin/Elastica/pull/1242/files#diff-154aad1be01fbe69e4f5790bcf273893R57 |
@Tobion Merged 🎉 THANKS |
Some things that are missing for #1184
Todo:
minimum_number_should_match
,geo_distance_range
,Query\Match::setFieldType
(see Update match query documentation elastic/elasticsearch#17536 )AbstractUpdateAction
is not good. scripts can be part of an update action but they are not the action itself. so the$id
parameter that I renamed to$documentId
(which was hard to grasp) doesn't belong there at all. but changing that would require rewrite of the scripts logic.ScriptId
class to reference stored scripts. This was completely missing so far.MatchPhrase
andMatchPhrasePrefix
should NOT extendMatch
because they don't share the same options