Strongloop Loopback connector for Elasticsearch
Hi! Have a problem with elasticsearch query
"native":
{
"sort":["_id"],
"query":{ query_string: { query: 'companyName:apple' } }
}}
no matter which query i am using in DEBUG i always get same result'{"sort":["_id"],"query":{"bool":{"must":{"match_all":{}},"filter":[{"term":{"docType":"LeadElastic"}}]}}}
this issue only when i am using "native" filter
"where" filter works ok but I need to use "query_string" and only way to use it is "native" filter
// TODO: native query support must be secured to restrict data access to request model /* if (criteria.native) { filter.body = criteria.native; // assume that the developer has provided ES compatible DSL } */
Found this in source code
@AndrewKuktenko , not planning for this now in connector as it requires us to create a property in model to hold aggregation data.
I would suggest to implement custom remote methods or a mixin for aggregation support.
You can always use esclient in your loopback code.
const myesclient = MyModel.getDataSource().connector.db;
// use es client search method for aggregationsmyesclient.search(...)