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

unsupported_operation_exception on collapse + docvalue_fields #96510

Closed
dgilmanAIDENTIFIED opened this issue Jun 1, 2023 · 6 comments · Fixed by #110103
Closed

unsupported_operation_exception on collapse + docvalue_fields #96510

dgilmanAIDENTIFIED opened this issue Jun 1, 2023 · 6 comments · Fixed by #110103
Assignees
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@dgilmanAIDENTIFIED
Copy link
Contributor

Elasticsearch Version

8.8.0

Installed Plugins

No response

Java Version

bundled

OS Version

Linux 5.19.0-1022-aws #23~22.04.1-Ubuntu SMP Fri Mar 17 15:38:24 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Problem Description

ES returns unsupported_operation_exception: null instead of a descriptive error message for a minimal query with collapse and docvalue_fields

{
  "took" : 196,
  "timed_out" : false,
  "_shards" : {
    "total" : 64,
    "successful" : 63,
    "skipped" : 0,
    "failed" : 1,
    "failures" : [
      {
        "shard" : 0,
        "index" : "idx",
        "node" : "rcZ4pURhRNSeSL349CCG-Q",
        "reason" : {
          "type" : "unsupported_operation_exception",
          "reason" : "unsupported_operation_exception: null"
        }
      }
    ]
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  }
}

Steps to Reproduce

{
 "collapse": {"field": "col1"},
  "docvalue_fields": [
  "col2",
  "col3"
 ]
}

Logs (if relevant)

No response

@dgilmanAIDENTIFIED dgilmanAIDENTIFIED added >bug needs:triage Requires assignment of a team area label labels Jun 1, 2023
@pxsalehi pxsalehi added :Search/Search Search-related issues that do not fall into other categories and removed needs:triage Requires assignment of a team area label labels Jun 2, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Jun 2, 2023
@nemphys
Copy link

nemphys commented Mar 27, 2024

Any news regarding this issue?
Still there in 8.12.2, seems impossible to use docvalue_fields when using collapse without getting this error:

Caused by: java.lang.UnsupportedOperationException
at java.base/java.util.AbstractCollection.add(AbstractCollection.java:253)
at [email protected]/org.elasticsearch.search.fetch.FetchContext.docValuesContext(FetchContext.java:179)
at [email protected]/org.elasticsearch.search.fetch.subphase.FetchDocValuesPhase.getProcessor(FetchDocValuesPhase.java:33)
at [email protected]/org.elasticsearch.search.fetch.FetchPhase.getProcessors(FetchPhase.java:183)
at [email protected]/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:108)
at [email protected]/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:78)
at [email protected]/org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:717)
at [email protected]/org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:688)
at [email protected]/org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:545)
at [email protected]/org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:73)
at [email protected]/org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:70)
at [email protected]/org.elasticsearch.action.ActionRunnable$4.doRun(ActionRunnable.java:95)
at [email protected]/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
... 6 more

@nemphys
Copy link

nemphys commented Mar 27, 2024

After further debugging this, I discovered that the exception is only thrown when the collapse field is not included in the docvalue_fields; as soon as it is added to the docvalue_fields list, the error goes away :-)

@benwtrent
Copy link
Member

wow thanks @nemphys ! What a weird and tricky bug...

We should at a minimum throw an error early indicating that if you are specifying fields to include, you must also include the collapse field.

@nemphys
Copy link

nemphys commented Mar 28, 2024

Or maybe silently include it by default when it is not there (?)

@benwtrent
Copy link
Member

Finally had some cycles to dig more into this. Found the silly bug. Should be fixed soon :)

Thank you @nemphys for the detailed debugging & @dgilmanAIDENTIFIED for reporting!!!

benwtrent added a commit to benwtrent/elasticsearch that referenced this issue Jun 25, 2024
There were some optimizations that broke collapse fields automatically
being added to `docvalue_fields` during the fetch phase. 

Consequently, users will get really weird errors like
`unsupported_operation_exception`. This commit corrects the intended
behavior of automatically including the collapse field in the
docvalue_fields context during fetch if it isn't already included.

closes: elastic#96510
benwtrent added a commit that referenced this issue Jun 26, 2024
…10154)

There were some optimizations that broke collapse fields automatically
being added to `docvalue_fields` during the fetch phase. 

Consequently, users will get really weird errors like
`unsupported_operation_exception`. This commit corrects the intended
behavior of automatically including the collapse field in the
docvalue_fields context during fetch if it isn't already included.

closes: #96510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants