-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch version (bin/elasticsearch --version): latest master snapshot (hash: 8839a72)
Plugins installed: []
JVM version (java -version): java version "11.0.1" 2018-10-16 LTS
OS version (uname -a if on a Unix-like system): Darwin Kernel Version 18.2.0
Description of the problem including expected versus actual behavior:
When performing a CCS search request, an error occurs if there is field collapsing in the query.
The exact error is:
java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object[] to the type of the destination array, org.apache.lucene.search.grouping.CollapseTopFieldDocs
at java.util.ArrayList.toArray(ArrayList.java:432) ~[?:?]
at org.elasticsearch.action.search.SearchPhaseController.mergeTopDocs(SearchPhaseController.java:236) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
at org.elasticsearch.action.search.SearchResponseMerger.getMergedResponse(SearchResponseMerger.java:190) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
at org.elasticsearch.action.search.TransportSearchAction$3.createFinalResponse(TransportSearchAction.java:389) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
at org.elasticsearch.action.search.TransportSearchAction$3.createFinalResponse(TransportSearchAction.java:379) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
Steps to reproduce:
- Start two ES instances, ensuring they have unique
cluster.names - Configure one ES instance to talk to the other through CCS
POST _cluster/settings
{
"persistent": {
"cluster": {
"remote": {
"other": {
"seeds": [
"{other_es_instance_address}"
]
}
}
}
}
}
- Put data in the an index on the ES cluster you ran the above query:
POST _bulk
{ "index": { "_index": "sales" } }
{ "price": 30, "payment_type": "credit_card" }
{ "index": { "_index": "sales" } }
{ "price": 40, "payment_type": "cash" }
- DO NOT put any data into the other ES cluster
- Perform a CCS search that uses field collapsing from the same ES instance
POST *:sales*,sales*/_search
{
"collapse": {
"field": "payment_type.keyword"
}
}
This error also happens if you modify step 4 to only put the index (but do not index documents into it) on the other ES instance:
PUT sales
{
"mappings": {
"properties" : {
"payment_type" : {
"type" : "text",
"fields" : {
"keyword" : {
"type" : "keyword",
"ignore_above" : 256
}
}
},
"price" : {
"type" : "long"
}
}
}
}
The error DOES NOT happen if you actually index documents into the index on the other ES cluster:
POST _bulk
{ "index": { "_index": "sales" } }
{ "price": 30, "payment_type": "credit_card" }
{ "index": { "_index": "sales" } }
{ "price": 40, "payment_type": "cash" }
This is currently BREAKING the Kibana Stack Monitoring app, as we run these sorts of field collapsing which are currently broken with CCS enabled.
Related to #40059