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

Unknown key for a START_ARRAY in [index]. #859

Open
adityajain-deqode opened this issue Sep 26, 2022 · 0 comments
Open

Unknown key for a START_ARRAY in [index]. #859

adityajain-deqode opened this issue Sep 26, 2022 · 0 comments

Comments

@adityajain-deqode
Copy link

adityajain-deqode commented Sep 26, 2022

I was upgrading rails from 6 to 6.1 and ruby from 2.6.7 to 3. In the same time I upgraded chewy from 5.0.0 to 6.0 and elasticsearch from 5 to 6. But, I didn't upgrade Elasticsearch Server which is already running on 5.6.16-alpine.

In my project we are using define_types at many places. So, when I look for search query I am getting this error:

[400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a START_ARRAY in [index].","line":1,"col":10}],"type":"parsing_exception","reason":"Unknown key for a START_ARRAY in [index].","line":1,"col":10},"status":400}


Expected behavior

It should work as before. Is should return indexed object in right manner.

Actual behavior

It was returning error:
[400] {"error":{"root_cause":[{"type":"parsing_exception","reason":"Unknown key for a START_ARRAY in [index].","line":1,"col":10}],"type":"parsing_exception","reason":"Unknown key for a START_ARRAY in [index].","line":1,"col":10},"status":400}.

When I observed I found here is some change in Index object like:
Before
<Dub::Index::OrganisationEntityIndex::Query {:index=>["organisation_entity"], :type=>["organisation_entity"], :body=>{:sort=>[{"_script"=>{:script=>{:file=>"group-account", :lang=>"painless", :params=>{:group_id=>1}}, :type=>"number", :order=>"desc"}}, {"primary_sort"=>:asc}], :size=>20, :from=>0, :query=>{:bool=>{:filter=>[{:terms=>{"belongs_to_group_id"=>[1]}}, {:term=>{:join_field=>"account"}}]}}}, :search_type=>"dfs_query_then_fetch"}>

After
<Dub::Index::OrganisationEntityIndex::Query {:body=>{:index=>["organisation_entity"], :type=>["organisation_entity"], :sort=>[{"_script"=>{:script=>{:file=>"group-account", :lang=>"painless", :params=>{:group_id=>1}}, :type=>"number", :order=>"desc"}}, {"primary_sort"=>:asc}], :size=>20, :from=>0, :query=>{:bool=>{:filter=>[{:terms=>{"belongs_to_group_id"=>[1]}}, {:term=>{:join_field=>"account"}}]}}}, :search_type=>"dfs_query_then_fetch"}>

Version Information

Share here essential version information such as:

  • Chewy version 5.2
  • Elasticsearch version gem version 5.0.5 server version 5.6.16
  • Ruby version 3.0.0
  • Rails version 6.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant