-
Notifications
You must be signed in to change notification settings - Fork 732
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
Elastica\Filter\Nested should be returned back #1001
Comments
There's also an option to move all filters to |
@kukulich Good point. Would it be sufficient to just make setFilter accept also AbstractQuery? What do you mean by "move all filters" to Elastica\Query? Removing filters completely? |
@kukulich Side note here: I think the points you are bringing up are the last major changes which are not properly done yet in Elastica 3.0.0. So I'm glad you got this discussion started. |
All filters are deprecated in favour of queries so this may be done:
Side note: Yes, I tried to migrate to Elastica 3.0.0 and found these issues :) |
Looks interesting, but I can't define how right it will be, especially without code cases, so feel free to ignore my 2 cents.
|
I think it would be good to follow Elasticsearch naming and there are only queries now, see eg. https://www.elastic.co/guide/en/elasticsearch/reference/2.0/query-dsl-geo-distance-filter.html |
@kukulich I agree with main idea follow Elasticsearch naming, lets look to documentation for now: https://www.elastic.co/guide/en/elasticsearch/reference/2.0/query-dsl-geo-distance-query.html "Filters documents that" It is all about filter. Documentation just show how to perform geo distance queries, but GeoDistanceQuery it is FilteredQuery + Filter. So, for me there is place for GeoDistanceFilter. How it looks for you? |
@ewgRa So you suggest to have both |
For me it looks like GeoDistanceQuery = Query + GeoDistanceFilter. Can you give example in code how you see it? for me it looks like this:
If for example Bool also support setFilter, I can do something like this:
|
I suggest have only GeoDistanceFilter. Have GeoDistanceQuery - it will be kind of synthetic sugar. Elasticsearch allow to filter by geodistance any queries. Would be nice to see how you see it. |
I understand your arguments however I think that |
Which one has less "features"? Query or Filter? The reason I ask is to decide which one should extend which one. It seems like every filter can also be used as a query but a query could have additional features? |
@kukulich Sure. Can you show code how you see it? Something like this?
I'm not sure (is this possible on ES side, maybe it is not a working case, haven't time to check), but how it will be handle than such ES queries?
When query have several filters? |
@ruflin As from this https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html than Query extends from Filter. |
@ewgRa That means we should probably also do that in our code. I would have to check if the setCached methods we have in here are still supported: https://github.com/ruflin/Elastica/blob/master/lib/Elastica/Filter/AbstractFilter.php |
So, I read docs carefully. "The behaviour of a query clause depends on whether it is used in query context or in filter context". As from this https://www.elastic.co/blog/better-query-execution-coming-elasticsearch-2-0 " the _cache and _cache_key options are now deprecated and will be ignored if provided". So, for me @kukulich right, filters must be deprecated at all, instead there is must be Queries, that can be performed in Query context, or Filter context. |
@kukulich +1 for what you suggest. +2 for good BC layer |
+1 for I was not right :) |
But in another hand this "boost" that still make no sense for filter context, but can be used in query context. |
@ewgRa I'm glad wed we found agreement :) |
@kukulich do you want take it? |
I don't know if I have time to do it this year :( Maybe in January |
Same for me, but maybe I can take it earlier. I think @ruflin would be glad to have it much earlier than January, so, who first will have time - just left notice here to avoid doing same work. |
👍 |
1 similar comment
👍 |
Can you just readd the changes? |
@ruflin I'm sorry, I don't understand what you mean. |
@kukulich You asked about reverting the commits. Instead of reverting them I suggest you just take the changes that were removed and readd them. Like this no changes of existing commits have to be made and you are not blocked by me. |
@ruflin Thanks, I understand it now. I thought the "readd" is typo of "read" :) |
+1 for this. I just started porting our Application to ES2.0 and ran into this issue. In our application we have a collection of filters that all get added to a BoolFilter which then gets added to a FilteredQuery. Previously in one case we were adding a NestedFilter that contained a BoolAnd Filter that included a bunch of other filters and this NestedFilter get added to the main BoolFilter. This worked perfectly before, but by removing the NestedFilter and replacing it with a NestedQuery it seems to be not possible to construct this type of nested filtering without rewriting everything. In the end one of our queries for ES 1.7.x which work fine looks like this: BTW, what is discussed here would go into Elastica 3.1 i guess as 3.0 is already in beta ? |
@awdng I still hope 3.0 :-) |
@kukulich Any updates here? |
Unfortunately I have no time for this now. Maybe in the end of January. |
I think I will have time on this week and make PR |
@ewgRa Very nice. I was thinking to do the 3.0.0 release today without the change and release 3.1.0 as soon as we have it. I think it is good to get more people on 3.0.0 in case there are some more bugs. Would that be ok for you? |
Yes, for me totally ok. |
I think you can release 3.0.0 if you revert the commits where you have removed Filter\Nested. |
@kukulich I readded the files and tests, but somehow the tests fail. See https://github.com/ruflin/Elastica/pull/1020/files#diff-80be7592e890c5e74f56b6a643b4c98eR94 for example. Do you know why? |
I start work on this issue. |
PR for deprecated filters #1031 |
I tested actual master and it works perfectly. |
@kukulich Good to hear. Thanks. |
@ruflin This is related to an error in the test code (master branch). I'm trying to do this query using Elastica, but am lost:
|
@rparsi I don't hope there is an error in the tests because currently the tests are green :-) Which version of Elastica are you using? |
@ruflin I'm using FOSElasticaBundle which is using elastic v2.1 Which branch or tag is considered the latest stable version of elastica? |
That is 3.2.1 today: https://github.com/ruflin/Elastica/releases |
Closing as the problem has been sorted out and the fusion of filters and queries is complete. |
It's not possible to filter nested objects without
Elastica\Filter\Nested
.Eg.
Elastica\Query\Filtered::setFilter()
requires\Elastica\Filter\AbstractFilter
so it's not possible to useElastica\Query\Nested
.The text was updated successfully, but these errors were encountered: