[ElasticSearch] SearchTerm is ignored when adding a predefined filter to the search-ui config
See original GitHub issueDescribe the bug SearchTerm is ignored when adding a predefined filter to the search-UI config. So doesn’t matter what you search on, the search will just return the items from the predefined filters.
To Reproduce
- add filter to the searchQuery object for example"
searchQuery: {
filters: [{ field: "id", type: "all", values: ["park_acadia"]}],
Note that for App Search this works fine!
- search for a value that you know will not give any results like
///\\/\/\/\/\/\/\//\\\
You will see that you will still get the result of the filter…
Expected behavior
- searchTerm must still work when having predefined filters
Which backends and packages are you using: Backend: [Elastic Search cloud]
"@elastic/react-search-ui": "^1.17.1",
"@elastic/react-search-ui-views": "^1.17.1",
"@elastic/search-ui": "^1.17.1",
"@elastic/search-ui-elasticsearch-connector": "^1.17.1",
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Term query | Elasticsearch Guide [8.5] | Elastic
The term query does not analyze the search term. The term query only searches for the exact term you provide. This means the...
Read more >elastic-search-ui/community - Gitter
I have two more questions, hoping they're not too much: is it possible to change the SearchDriver's state (especially filters) without triggering a...
Read more >Elastic search filtered query, query part being ignored?
Your filter is not at the right level. It should not be inside query but at the same level as query like this:...
Read more >@elastic/react-search-ui - npm
Headless Core - Leverage our application logic and provide your own Components or view. URL query string synchronization - Searches, filtering, ...
Read more >Search Experience - Open Distro for Elasticsearch
Highlight query matches, Highlight the search term in the results. ... To configure a field to use edge N-grams, create an autocomplete analyzer...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hi there! Not sure if related, but we came to an interesting situation and it feels like the right issue to post this in.
The filter we are applying looks like this:
Within the input that you can see in the video below, we would would like to allow users to further specify the results they are seeing by allowing them to set a search term on top of the pre-defined filters in the config. Just to clarify, this is the handler for setting the search term:
Combining this, we do actually see that setSearchTerm seems to be working, but it seems to sort the results rather than filtering out results that can be considered irrelevant by setting the searchTerm. Please note that the items you see in the video is the subset of our total index based on the pre-defined filters.
https://user-images.githubusercontent.com/10176709/199464191-987406c7-f335-4ab0-9e50-cbec45e77ac1.mp4
I’ve tried to debug the query that gets sent over to Elastic by logging the request body. The interesting part is that setting the search term (and filters) client side through the input onChange leads to quite a bit of a different query compared to the an initial query where filters + a search term is applied
@ZakKa89 If you want to help us fix any of this… we are hiring 😃