I am sending requests from Node.js to ES, It was fine before I put the "preference" option to the code. and I am getting the same error : "Unknown key for a VALUE_STRING in [preference]."
my code : `
client
.search({
_source: TEST_TILEDS,
index: TEST_INDEX,
size: _.isNumber(pageSize) === false ? 20 : pageSize,
body : {
min_score: 1,
query,
explain: false,
preference: userUuid,
},
})
`
I want to use Custom value for preference options like the documents said here
When I tried in Kibana it worked well with localhost:9200/_search?preference='asdf' but if I put the preference key value in the inside of {} json like below, then it just doesn't work out.
`
GET alias_search_tabling_restaurant_production/_search
{
"query": {
"bool":
blabla
},
"preference": "asdf" //
}
`
Is there any solution for this? Thank you in advance.
like I explained above, I tried in Kibana but only url + options worked but not the options in json or node.js code.
How about using queryString
, and passing it as a query parameter?
client
.search({
_source: TEST_TILEDS,
index: TEST_INDEX,
size: _.isNumber(pageSize) === false ? 20 : pageSize,
queryString: {"preference": userUuid},
body : {
min_score: 1,
query,
explain: false,
preference: userUuid,
},
})