Skip to content

dfs_query_then_fetch can cause serialization errors with 6.x nodes #75349

@jtibshirani

Description

@jtibshirani

In a mixed 6.x and 7.x cluster, a search that uses dfs_query_then_fetch can cause a transport serialization error:

[2021-07-14T14:48:54,223][DEBUG][o.e.a.s.TransportSearchAction] [v6.8.11-2] [16] Failed to execute query phase
 org.elasticsearch.transport.RemoteTransportException: [v6.8.11-0][127.0.0.1:50319][indices:data/read/search[phase/query/id]]
Caused by: java.lang.IllegalArgumentException: totalTermFreq must be positive, totalTermFreq: -1
      at org.apache.lucene.search.TermStatistics.<init>(TermStatistics.java:70) ~[lucene-core-7.7.3.jar:7.7.3 1a0d2a901dfec93676b0fe8be425101ceb754b85 - noble - 2020-04-21 10:31:55]
      at org.elasticsearch.search.dfs.AggregatedDfs.<init>(AggregatedDfs.java:37) ~[elasticsearch-6.8.11.jar:6.8.11]
      at org.elasticsearch.search.query.QuerySearchRequest.<init>(QuerySearchRequest.java:48) ~[elasticsearch-6.8.11.jar:6.8.11]
      at org.elasticsearch.transport.RequestHandlerRegistry.newRequest(RequestHandlerRegistry.java:48) ~[elasticsearch-6.8.

This seems related to https://issues.apache.org/jira/browse/LUCENE-8007, which was introduced in Lucene 8 and adds stricter checks to TermStatistics.

I was able to reproduce this with our rolling upgrade tests. A rough example:

  1. In the old 6.8 cluster, create a couple documents with a keyword value like "field": "some_value".
  2. In a mixed 6.8 and 7.x cluster, perform a search on the field:
    GET /index/_search?search_type=dfs_query_then_fetch
    {
      "query": {
        "match": {
          "field": {
            "query": "some_value"
          }
        }
      }
    }
    

This search can then fail with the same serialization error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bugTeam:SearchMeta label for search team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions