-
-
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-plugin] Allow script_fields in search request body #1143
Comments
I've been working on this and I'm nearly finished. I found out that @michaelbromley What do you think? customProductMappings: {
answer: {
graphQlType: 'Int!',
valueFn: args => {
return 42;
},
},
},
searchConfig: {
scriptFields: {
answerDouble: {
graphQlType: 'Int!',
environment: 'product',
scriptFn: (input) => ({
script: `doc['answer'].value * 2` // answer is not mapped for synthetic products
})
}
}
} |
@Draykee hi! How did you managed to extend |
@Izayda My example was just assuming that it was done. You can do it with another plugin or inside the |
…uation of every hit (vendure-ecommerce#1143)
…uation of every hit (vendure-ecommerce#1143)
Is your feature request related to a problem? Please describe.
There is currently no possibility to set
script_fields
to allow script evaluation for each hit.https://www.elastic.co/guide/en/elasticsearch/reference/7.8/search-fields.html#script-fields
Describe the solution you'd like
"_source": true,
needs to be set in the request body to still include the whole index document (When using script fields, the default response will not contain the _source field but only the custom field we have defined)Additional context
Assuming the product should receive a location via custom fields. I would like to add geo location based search and therefore I extend the SearchInput with
latitude
,longitude
(and alsdistance
). Here is a example of a possible configutation:This script will add a field with the distance like this inside the ElasticSearch response:
The text was updated successfully, but these errors were encountered: