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

sortBy doesn't work in MultiDropdownList anymore. #2058

Open
allendol opened this issue Aug 29, 2022 · 7 comments
Open

sortBy doesn't work in MultiDropdownList anymore. #2058

allendol opened this issue Aug 29, 2022 · 7 comments
Assignees
Labels

Comments

@allendol
Copy link

We use Reactiveasearch pointing to ElasticSeacrh 6.x
Recently we migrated ElasticSeacrh 6.8 to ElasticSeacrh 8.x
Now sortBy doesn't work in MultiDropdownList . I have to comment it in order I see data in MultiDropdownList.

Describe the bug

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Screenshots

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

@allendol allendol added the bug label Aug 29, 2022
@siddharthlatest
Copy link
Member

@allendol Can you share a CSB where this issue is replicable?

@allendol
Copy link
Author

allendol commented Aug 29, 2022

@siddharthlatest where can I share? Is there any sandbox I can use?

@siddharthlatest
Copy link
Member

@allendol You can take this as a base: https://codesandbox.io/s/compassionate-forest-g9ej6f, and update to point to an ES instance where this issue can be reproduced.

@allendol
Copy link
Author

@siddharthlatest stupid question. When I change something in above, how can I save and run it?

@waotaa
Copy link

waotaa commented Aug 31, 2022

with version: "@appbaseio/reactivesearch-vue@1.30.0"

I also recently upgraded my packages and experience an error with the sortBy.
In singlelists and multilists with for example sortBy="asc"

The error I get in my console is:
{"error":{"root_cause":[{"type":"aggregation_execution_exception","reason":"Invalid aggregation order path [_term]. The provided aggregation [_term] either does not exist, or is a pipeline aggregation and cannot be used to sort the buckets."}

@allendol
Copy link
Author

allendol commented Sep 13, 2022

@siddharthlatest I have narrowed down the problem.
When I am using ElasticSearch 6 the query generated from ReactiveSearch is as below.
{"preference":"Selected Dis"}
{"query":{"bool":{"must":[{"bool":{"must":[{"bool":{"should":[{"terms":{"supt.keyword":["Supply and Service"]}}]}}]}}]}},"size":0,"aggs":{"office.keyword":{"terms":{"field":"office.keyword","size":1000,"order":{"_term":"asc"}}}}}
In above _term used to to the order by.
This is working.
In ELasticSearch 8. "_term":"asc" gives error
In ELasticSearch 8. the query should be converted to _key":"desc"
But the version of ReactiveSearch I have it doesn't generate _key":"desc". It still generated _term":"asc" and this is giving error.
Query below order by count which I don't want. I want to be ordered by name not count.
{"preference":"Selected Dis"}
{"query":{"bool":{"must":[{"bool":{"must":[{"bool":{"should":[{"terms":{"supt.keyword":["Supply and Service"]}}]}}]}}]}},"size":0,"aggs":{"office.keyword":{"terms":{"field":"office.keyword","size":1000,"order":{"_count":"asc"}}}}}
The error I get is:
"reason": "_Invalid aggregation order path [_term]. Cannot find aggregation named [term]"
Environment: Elasticsearch 8 and old Reactivesearch

@siddharthlatest siddharthlatest changed the title sortBy doens't work in MultiDropdownList anymore. sortBy doesn't work in MultiDropdownList anymore. Sep 16, 2022
@siddharthlatest
Copy link
Member

@allendol Which version of the library are you using? I can't reproduce this in v3.38.3 (or above), the network request sent does use _key to sort on, tested with MultiDropdownList component:

{"preference":"BookSensor"}
{"query":{"match_all":{}},"size":0,"aggs":{"original_series.keyword":{"terms":{"field":"original_series.keyword","size":100,"order":{"_key":"asc"}}}}}

Can you share a CodeSandbox where the issue is reproducible?

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

4 participants