I also search using multi-match queries with cross_fields. Changing it to best_fields also works.
In my environment it seems that array fields are causing the problem.
I've got a mapping like:
{
"properties": {
"description": {
"type": "text",
"similarity": "custom_similarity",
"term_vector" : "with_positions_offsets",
"analyzer": "standard_analyzer",
"search_analyzer": "standard_search_analyzer",
"fields": {
"ngram": {
"type": "text",
"similarity": "custom_similarity",
"analyzer": "ngram_analyzer",
"search_analyzer": "standard_search_analyzer"
},
"edge_ngram_prefix": {
"type": "text",
"similarity": "custom_similarity",
"analyzer": "edge_ngram_1_analyzer",
"search_analyzer": "standard_search_analyzer"
}
}
},
"tags": {
"type": "text",
"similarity": "custom_similarity",
"analyzer": "standard_analyzer",
"search_analyzer": "standard_search_analyzer",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
And I post data like:
POST /some_index/_doc
{
"description": "Some description",
"tags": ["foo", "bar", "foo bar"]
}
When I search in both fields the query fails.
The query looks like:
{
"from":0,
"size":100,
"query":{
"bool":{
"must":[
{
"function_score":{
"query":{
"bool":{
"must":[
{
"function_score":{
"query":{
"multi_match":{
"query":"foo",
"fields":[
"description^3.0",
"description.edge_ngram_prefix^0.90000004",
"description.ngram^0.6",
"tags^1.0"
],
"type":"cross_fields",
"operator":"AND",
"slop":0,
"prefix_length":0,
"max_expansions":50,
"tie_breaker":0.05,
"zero_terms_query":"NONE",
"auto_generate_synonyms_phrase_query":true,
"fuzzy_transpositions":true,
"boost":1.0
}
},
"functions":[
{
"filter":{
"match_all":{
"boost":1.0
}
},
"field_value_factor":{
"field":"boost",
"factor":1.0,
"modifier":"none"
}
}
],
"score_mode":"sum",
"max_boost":3.4028235E38,
"boost":1.0
}
}
],
"adjust_pure_negative":true,
"boost":1.0
}
}
}
}
],
"adjust_pure_negative":true,
"boost":1.0
}
}
}
Unfortunately I was not yet able to reproduce the problem in a simple example. By now it only happens when I index tons of data in my index.
I've removed all those array fields from the query now. And I do no longer get this error.