Closed Bhacaz closed 3 years ago
@Bhacaz Thanks! Could you please describe how to reproduce the error?
Sure, I updated the PR description.
As far as I can see, there are much more things to fail with the legacy DSL, for example, Chewy::Stash::Journal.clean
. Am I missing something?
@rabotyaga
I'm aware that many thing doesn't work with the the legacy DSL and old version of ElasticSearch. My objectif with this PR is only that since Chewy offer the option to use the legacy DSL, a build-in feature should not raise an error method_missing
when it's configured that way.
The reason I proposed this change, is that Chewy offer the possibility to configure which DSL indexes class will used. So every class who inherited from Chewy::Index
will use the configured DSL, the old Chewy::Query
or the default Chewy::Search::Request
.
I far as I know, there is two classes that inherited from Chewy::Index
in Chewy, Chewy::Stash::Specification
and Chewy::Stash::Journal
. And Chewy::Stash::Journal
use his Chewy::Search::ClassMethods#search_class
. Sadly Chewy::Stash::Journal.for
called Chewy::Search::Request#or
which it's not defined in the old DSL.
I refactored the method to only use filter
which is defined in both DSL. I looked around and as far as I can see it is the only place that may cause that type of error.
I meant - does this fix changes something in terms of legacy DSL usage? Is this place is the only one, that prevents legacy DSL usage? Looks like not, and then we will have to chase the goal of making legacy DSL working, while our goal right now is quite the opposite - bring support for ES6 and then ES7.
does this fix changes something in terms of legacy DSL usage?
Yes, if someone use the configuration Chewy.search_class = Chewy::Query
he cannot use the Journialing feature.
Is this place is the only one, that prevents legacy DSL usage?
Yes, Chewy::Stash::Specification
and Chewy::Stash::Journal
are the only index classes created inside Chewy, so it limite the research.
while our goal right now is quite the opposite - bring support for ES6 and then ES7.
I totally understand and I look forward for it. I don't want anybody to waste energy on old features. Be free to simply reject the PR I will totally understand. 😃
@Bhacaz Let's close this by now, as it doesn't render Stash completely working with the legacy DSL (try the following patch and run the specs
--- a/spec/chewy/stash_spec.rb
+++ b/spec/chewy/stash_spec.rb
@@ -5,6 +5,7 @@ describe Chewy::Stash::Journal, :orm do
response['deleted'] || response['_indices']['_all']['deleted']
end
+ before { Chewy.search_class = Chewy::Query }
before { Chewy.massacre }
before do
) and, at the same time, introduces some crutches. Thanks a lot for your effort!
Hi, I know that change can seems no necessary, but the gem did a really good job supporting old version of ElasticSearch. However I found that query while testing an old app and it takes for granted that the
search_class
isChewy::Search::Request
and it doesn't work with the oldChewy::Query
.Here the error I got before the change:
I thing the new implementation looks a bit heavy and doesn’t use must of the DSLs, but it works for ES < 2 and newer.
Step to reproduce:
Error: