I personally would not count any any default behaviors and would choose to use match_all explicitly in my calls. Having some filtered queries with no query (default match all) and some with a more detailed query would be inconsistent, so my preference would be to always have a query.
It comes down to personal preference. At this point, changing the default behavior would be a breaking change, so I doubt the Elasticsearch team would ever revert, but you never know... -- Ivan On Mon, Jun 9, 2014 at 12:50 AM, Arkadiy Zabazhanov <kinwiz...@gmail.com> wrote: > Yeah, it does matter because previously I had to add match_all to empty > queries if I was need to get all the results in case of empty query. It > seems currently any empty query replaces with match_all (this follows from > your links), so I don't need to use it explicitly anymore. Am I correct? > > I just need to confirm this to remove obsolete code from my library. > > понедельник, 9 июня 2014 г., 14:28:07 UTC+7 пользователь Ivan Brusic > написал: >> >> Does it matter? From what I can tell, some code was added in 0.90 >> >> https://github.com/elasticsearch/elasticsearch/commit/ >> 6687ecb038b55416d4bb37d29746e86f2624f06b >> https://github.com/elasticsearch/elasticsearch/ >> blob/master/src/main/java/org/elasticsearch/index/query/ >> FilteredQueryParser.java#L54 >> >> -- >> Ivan >> >> >> On Sun, Jun 8, 2014 at 9:34 PM, Arkadiy Zabazhanov <kinw...@gmail.com> >> wrote: >> >>> Guys, I still need help, A've tried to change filtered query strategies. >>> It returns all the filtered results anyway for versions 1.0.0 - 1.2.1. When >>> this behavior was changed and how? Why don't I need match_all for filtered >>> query with empty query? >>> >>> пятница, 6 июня 2014 г., 7:14:28 UTC+7 пользователь Arkadiy Zabazhanov >>> написал: >>> >>>> Yeah, I've got ehis already, thanks. >>>> >>>> I'm still confused why filtered query is returning all results even >>>> without match_all in filtered query. >>>> >>>> четверг, 5 июня 2014 г., 6:21:03 UTC+7 пользователь Ivan Brusic написал: >>>>> >>>>> There is no label, but the change was made last December: >>>>> >>>>> https://github.com/elasticsearch/elasticsearch/pull/4461 >>>>> >>>>> It appears that the REST API still supports the old notation, but the >>>>> change did break Java backwards compatibility >>>>> >>>>> https://github.com/elasticsearch/elasticsearch/blob/master/ >>>>> src/main/java/org/elasticsearch/search/query/QueryPhase.java#L71 >>>>> >>>>> -- >>>>> Ivan >>>>> >>>>> >>>>> >>>>> On Tue, Jun 3, 2014 at 8:11 PM, Arkadiy Zabazhanov <kinw...@gmail.com> >>>>> wrote: >>>>> >>>>>> Btw, Answer for the second question is top-level filter was renamed >>>>>> to post_filter. That's awesome. So the first question is answered too. >>>>>> Filtered query is preferred. >>>>>> Still waiting for an answer for the third question. Since I didn't >>>>>> find filter to post_filter renaming in changelog ( >>>>>> http://www.elasticsearch.org/downloads/1-0-0/) and I can't find >>>>>> anything about new query behavior. I need just version where was it >>>>>> changed, please. >>>>>> >>>>>> вторник, 3 июня 2014 г., 19:27:17 UTC+7 пользователь Arkadiy >>>>>> Zabazhanov написал: >>>>>> >>>>>>> Hello. Help me please, I'm confused. As far as I remember, there was >>>>>>> the only way to pass filters to search query - via filtered query. But >>>>>>> currently there is a top-level filter part of the query. However, >>>>>>> top-level filter affects query only and doesn't affect i.e. facets. >>>>>>> But filtered query filter affects both of the query and facets >>>>>>> facilities. Also, I remember there was a time I need to add >>>>>>> match_all query to filtered query section if query was empty and >>>>>>> filters only was present. Otherwise returned empty set of documents. >>>>>>> Since >>>>>>> I'm trying to create high-level Ruby library could you please answer >>>>>>> following questions: >>>>>>> >>>>>>> 1) Which way is preferred now and in future: filtered top-level >>>>>>> query or top-level filter with top-level query? >>>>>>> 2) How do you plan to resolve such an API inconsistency when >>>>>>> filtered query filter affects outside statements and top-level filter >>>>>>> doesn't affect some parts of request? >>>>>>> 3) Why do I remember about match_all feature and when did requests >>>>>>> started to return all the documents with empty query section in filtered >>>>>>> query? I'm checking it right now on 1.2.0 and I don't need to use >>>>>>> match_all, or constant_score it just returns all the docs for me. >>>>>>> >>>>>>> Thanks in advance. >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "elasticsearch" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to elasticsearc...@googlegroups.com. >>>>>> To view this discussion on the web visit https://groups.google.com/d/ >>>>>> msgid/elasticsearch/c8bddc46-7347-4ca9-a9ea-65100a017673%40goo >>>>>> glegroups.com >>>>>> <https://groups.google.com/d/msgid/elasticsearch/c8bddc46-7347-4ca9-a9ea-65100a017673%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elasticsearch" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to elasticsearc...@googlegroups.com. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/elasticsearch/811a5138-21d1-4ad0-a051-510a7494be65% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/elasticsearch/811a5138-21d1-4ad0-a051-510a7494be65%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/3f0cd8ef-a31c-41a4-96b3-eef233b0fda9%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/3f0cd8ef-a31c-41a4-96b3-eef233b0fda9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDcnKWT%3DesSaw0urLmZVT470xMCQ98W7D5uHDLr0JZ5Gw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.