Skip to content
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] Can't filter onAutocomplete results #891

Open
ZakKa89 opened this issue Oct 28, 2022 · 3 comments
Open

[ElasticSearch] Can't filter onAutocomplete results #891

ZakKa89 opened this issue Oct 28, 2022 · 3 comments
Labels

Comments

@ZakKa89
Copy link

ZakKa89 commented Oct 28, 2022

Describe the bug

Can't filter onAutocomplete results, there is no mention in the docs, but the type definition allows me to add the filters.
https://docs.elastic.co/search-ui/api/core/configuration#autocomplete-query

Question: The docs also mention a global queryConfig which could maybe solve/workaround my problem: #890

To Reproduce
Steps to reproduce the behavior:

Put this in results on autocompleteQuery for the search UI config

  autocompleteQuery: {
    results: {
      filters: [{ field: "id", type: "all", values: ["park_wind-cave"] }],

https://codesandbox.io/s/nice-curie-fy9js1?file=/src/pages/elasticsearch/index.js

Note that in App Search this works fine! I tested both in the sandbox!

Expected behavior
Only show autosuggestion with that id
if not supported yet, don't add it to the type definition and make it clear in the docs.

Screenshots
image
image

Which backends and packages are you using:
Backend: [Elasticsearch]
Packages: [react-search-ui]


     // frontend
    "@elastic/react-search-ui": "^1.17.1",
    "@elastic/react-search-ui-views": "^1.17.1",
    "@elastic/search-ui": "^1.17.1",
     // api
    "@elastic/elasticsearch": "^8.2.1",
    "@elastic/search-ui-elasticsearch-connector": "^1.17.1",


@ZakKa89 ZakKa89 added the bug Something isn't working label Oct 28, 2022
@ZakKa89
Copy link
Author

ZakKa89 commented Oct 28, 2022

I looked into the package itself: It does look like there is no code related to filters at all in the autocomplete folder:

handlers/autocomplete/index.js

while in handlers/search there is something done with the filters object:

        const baseFilters = buildBaseFilters(queryConfig.filters);

@ZakKa89 ZakKa89 changed the title Can't filter onAutocomplete results [ElasticSearch] Can't filter onAutocomplete results Oct 28, 2022
@JasonStoltz
Copy link
Member

Great catch, again. I appreciate the bug report.

@plavaga-rc
Copy link

Hey @JasonStoltz, any timelines for getting this implemented?

In another thread, you mentioned that the filtering feature is not planned for App Search suggestions. Do you know if this also holds in the context of this bug report? If yes, is a workaround possible (within the context of using @elastic/react-search-ui)?

Cheers!
./.rc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants