-
Notifications
You must be signed in to change notification settings - Fork 56
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
support for a dynamix index #47
Comments
You use case is interesting and possible because the source code doesn't tie down the underlying driver to a specific Made an exploratory video where I try to brainstorm what someone might have to do to make this happen: |
In chat I had mentioned:
So its interesting, that today I found a usecase about mongodb where the user wanted to switch out the collections accessed by the connector: strongloop/loopback#2603 Just FYI. |
Based on Pulkit's video instruction, I made a workaround and it works for query for now. What I did are:
filter.index would be overwritten if a valid timescale parameter is available, otherwise, it still uses the one in datasource.json file.
|
It works for query, but not for count. I'm thinking I may need to implement it in buildWhere function. Another task is need to figure out how to validate an index in ES by using ES API. |
@onstrike07 did you changes something on the constructor or defaults? Thanks. |
I only added something in the function below in esConnector.js ESConnector.prototype.buildFilter |
@0candy, @jannyHou, @superkhau and @bajtos - I wanted to enable users of this elascticsearch connector to build "dynamic indexes" by providing a function in the
But regarding environment-specific configuration it says here that:
That's a bummer ... i feel like it should be possible to use a function despite that warning, no? |
cc @onstrike07 and @juanpujol - the comment above highlights my latest plan for enabling dynamic indices. Along with a minor change to:
It doesn't have room for the |
@pulkitsinghal I'm not sure about the ramification to supplying a function, you can give it a shot and let us know of any issues you run into. The only negative I can see is it won't work with the |
I think using functions should be fine. Here is the source code of the type-compatibility check used by loopback-boot: https://github.com/strongloop/loopback-boot/blob/0d985bae0ba918395660850711acad32cbf964cb/lib/config-loader.js#L300-L313 @pulkitsinghal Could you perhaps send a pull request to correctthat sentence you quoted? |
@bajtos and @superkhau - thank you! And a have one follow up question about testing.
|
1+2) I think you should inject it via env vars or the way we do with rc at https://github.com/strongloop/loopback-connector-mysql/blob/master/test/init.js#L14-L24 -- this keeps things at the connector level (ie. it doesn't care about the datasource-test.json -- it takes any acceptible config value and assumes caller has already sanitized the object properly).
|
I want to take a moment to point out the fact that @onstrike07's code used caching because of global variables being reused. Caching is something which I should give some thought to as well if the index/mapping checks are happening repeatedly. |
thank you for your earlier comments @superkhau |
@onstrike07 - it is a bit trickier than i thought:
|
I agree it's complicated. Fortunately, my project only requires query, but not the whole set of CRUD. I doubt it if it makes sense to insert a record in multiple indices in a single statement. |
cc @onstrike07
The text was updated successfully, but these errors were encountered: