Signed search keys are not supported for all query types
See original GitHub issueWhen instantiating an AppSearchAPIConnector
, you can provide a signed search key rather than the public search key. Here’s an example JSON object that we’re passing in a signed key for some queries:
{
"result_fields": {
"full_name": {"raw": {}, "snippet": {"size": 100, "fallback": true}},
"url": {"raw": {}},
},
"filters": {"is_public": "true"},
}
This works as expected when running the setSearchTerm
action with default options (i.e. hitting the search.json
endpoint). However, when running with the autocompleteSuggestions
option set to true (i.e. hitting the /query_suggestion
endpoint), these requests can fail, with the following response:
[400] Options contains invalid keys: result_fields and filters
This is because the options encoded in the JWT are applied to all query requests, and autocomplete queries do not support the result_fields
and filters
options that regular queries do.
A few possible solutions:
- Document this as expected behavior and recommend using separate connector and driver instances when you need to support both normal and autocomplete queries
- Add an option to the connector to pass a different
searchKey
when performing autocomplete queries - Add an option to
setSearchTerm
to pass a differentsearchKey
on a per-query basis that overrides the key that was set when instantiating the connector
// pinging @JasonStoltz because we discussed this earlier today on Slack
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:5 (1 by maintainers)
@TCMiranda I’ve responded to your issue in elastic/app-search-javascript. Let’s keep that conversation separate!
Oh, I think this is a different issue! The second request is made to get disjunctive facets, right?
But in my case, I had no filters, which caused the request to be made this way:
If I remove this empty filter property, it works.