-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
ElasticSearch: Allow custom search queries #364
Comments
Just so I fully understand the context: can you explain the benefit of this approach over just providing e.g. a |
I mean that'd be perfectly fine as well. I'm just not sure where this |
To be clear, I like your solution - just exploring your reasoning a bit. I can imagine a use for both to be honest. Your solution has the benefit of integrating with the existing API, with all the benefits of having the existing pagination/sorting/filtering already in place. So e.g. it would just work in the Admin UI. Perhaps exposing a raw query would have some security implications (e.g. can you DOS an ES instance with a really expensive query?) and we should leave it to individual implementers to add it themselves if they see fit. After all if you already have an ES instance available, adding a Would you like to implement and PR your solution? |
Oh I see, now I understand what you meant. Yes my thoughts were that the existing elastic search plugin already has a lot of features implemented (e.g. customProductMappings, integration with the admin / standard search api etc.) and thus I thought I'd be easier to add such a option than to implement the whole plugin on your own if you wanted a slightly different query on the same index. And yes, exposing a I thought what you meant is a typescript function that could be called from other plugins that implement a custom search for example. But as you already mentioned writing a plugin that does a simple REST request isn't all too difficult. Yes, if you think this solution is okay then I'd be happy to create a PR. |
Great, then send in a PR when you can :) |
The discussion for the feature took place in vendure-ecommerce#364. This commit closes vendure-ecommerce#364.
The discussion for the feature took place in vendure-ecommerce#364. This commit closes vendure-ecommerce#364. squash
Is your feature request related to a problem? Please describe.
I'm quite happy with the current implementation of the search plugins but the search options for both, the elastic search and the default search are a little limited. For the default search I guess that is fine but for the elastic search plugin it would be nice to have more options. For example wildcard queries and fuzzy searches aren't supported.
In my specific case I would like to run wildcard queries on productName and productVariantName and the existing multi_match query on the remaining fields such as the description, i.e. something like
Describe the solution you'd like
The easiest and most powerful option would probably be to allow a custom function, let's say
that is called at the end of
vendure/packages/elasticsearch-plugin/src/build-elastic-body.ts
Lines 10 to 15 in f385d69
, i.e. in line 91
vendure/packages/elasticsearch-plugin/src/build-elastic-body.ts
Lines 90 to 95 in f385d69
Describe alternatives you've considered
An alternative would be to create a very complex option object that could be passed to the plugin. This would require a lot of work compared to the solution described above.
Additional context
–
The text was updated successfully, but these errors were encountered: