Closed wolfgang-s closed 7 years ago
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."
@wolfgang-s Thanks for the PR. Please find my comments inline and update the PR with your previous solution. We are very soon to release a new version with filter bug fixes and it would be a great help if you can submit the PR asap.
@aquid I don't see any comments? This is my first PR maybe I'm missing something out? :)
What do you mean with "previous" solution, do you mean this solution in this PR?
The solution in my master branch makes this refresh settings configurable, which is bad I think, because all other datasource connectors will make all DB changes available instantly (right?) ...
Interesting read: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-refresh.html
What do you think? Should we make it configurable by model? Defaulting to "refresh: true"?
I personally think, putting load onto the database is not the problem, but slow response times in the frontend is.
Another idea would be to make it configurable per model AND per call. So let's say, when I insert articles via a CSV uploader, I do not want to index every time for every article. But when I create a single article, I do want it to be visible instantly. <- Problem here, I have no clue how to realize this.
I think my solution for now is pretty neat. I could submit another PR later ...
@wolfgang-s
I don't see any comments?
What do you mean with "previous" solution, do you mean this solution in this PR?
because all other datasource connectors will make all DB changes available instantly (right?)
Yes, most of the connectors will do that, but as we know that making refresh:true by default can create huge performance issues in elasticsearch, so I would rather leave this decision to the user and make this option configurable.
Another idea would be to make it configurable per model AND per call
This would be a perfect solution. You can have a look at this issue and validate if this could be useful for doing per request refresh option.
Let me know if you would be interested in updating the PR with making the option configurable.
@aquid Ok, I make it configurable as in my master branch and default true (!?), per model and per call using the options parameter.
I still don't see any inline comments :(
@wolfgang-s
I make it configurable as in my master branch and default true (!?)
Default to true is perfect.
@wolfgang-s Also don't change the existing tests instead, create a new file/tests without timeout
and change the existing ones as pending/inactive ( change describe as xdescribe
) that way anyone running the tests with refresh:false
would still be able to run test successfully by manually editing the describe block.
@aquid everything should be fine now ;)
what do you think?
@wolfgang-s Almost there. just few more changes.
refresh
and you can send a new PR for options
FYI - options
added looks great but we need to be sure that this supports earlier versions too where options were not passed. moreover, I see this code from mongo-connector which makes me think that we should also be implementing this.
@aquid
Here you go: https://github.com/strongloop-community/loopback-connector-elastic-search/pull/81 This pull request can be ignored now.
To me it seems refreshOn
is not per model but rather applies to all models, am I wrong? If that work is remaining, then should we create a new issue for the future?
all tests pass now in 8 seconds instead of 2 minutes.
remove comments as you like ...
only test which has still a timeout is "should only delete instances that satisfy the where condition"
here i was not able to remove it? No idea why ... very weird, has nothing to do with es or refresh?!