Weird results (and explanation) when combining KNN and ELSER in RRF

Hello, community,

I’m experiencing unexpected behavior in the explain output when using Elasticsearch with both ELSER and KNN in RRF. Specifically, the explanation details for KNN differ when executed alongside ELSER compared to running KNN alone. It is like when running together, the results are "combined", the part for method KNN EMBEDDING even has the "elser field" in the details:

"description": "Linear function on the complete_description_elser_embedding field for the ben feature, computed as w * S from:",

which sounds pretty weird to me, something I wouldn't expect since they are two different searches in my query and have different fields!

Would appreciate if someone could tell what's happening under the hood. Elasticsearch deployed version is 8.15.3. Codes were tested using both console and python client.

Code 1:

GET /my-index/_search?explain=true
{
  "_source": {
    "excludes": [
      "complete_description_elser_embedding",
      "complete_description_vector"
    ]
  },
  "retriever": {
    "rrf": {
      "retrievers": [
        {
          "standard": {
            "query": {
              "sparse_vector": {
                "field": "complete_description_elser_embedding",
                "inference_id": ".elser_model_2",
                "query": "term",
                "_name": "*** METHOD_ELSER ***"
              }
            }
          }
        },
        {
          "standard": {
            "query": {
              "match": {
                "query": "term"
                
              }
            }
          }
        },
        {
          "knn": {
            "field": "complete_description_vector",
            "query_vector": "${embedding}",
            "k": 10,
            "num_candidates": 10,
            "_name": "*** METHOD_KNN_EMBEDDINGS ***"
          }
        }
      ],
      "rank_constant": 1,
      "rank_window_size": 50
    }
  }
}

Explanation results from Code 1:
(unexpected, at least for me)

      "matched_queries": [
          "*** METHOD_KNN_EMBEDDINGS ***",
          "*** METHOD_ELSER ***"
        ],
        "_explanation": {
          "value": 0.8333334,
          "description": "rrf score: [0.8333334] computed for initial ranks [2, 0, 1] with rankConstant: [1] as sum of [1 / (rank + rankConstant)] for each query",
          "details": [
            {
              "value": 2,
              "description": "rrf score: [0.33333334], for rank [2] in query [*** METHOD_ELSER ***] computed as [1 / (2 + 1]), for matching query with score: ",
              "details": [
                {
                  "value": 5.4686527,
                  "description": "Linear function on the complete_description_elser_embedding field for the 25 feature, computed as w * S from:",
                  "details": [
                    {
                      "value": 2.4221022,
                      "description": "w, weight of this function",
                      "details": []
                    },
                    {
                      "value": 2.2578125,
                      "description": "S, feature value",
                      "details": []
                    }
                  ]
                }
              ]
            },
            {
              "value": 0,
              "description": "rrf score: [0], result not found in query at index [1]",
              "details": []
            },
            {
              "value": 1,
              "description": "rrf score: [0.5], for rank [1] in query [*** METHOD_KNN_EMBEDDINGS ***] computed as [1 / (1 + 1]), for matching query with score: ",
              "details": [
                {
                  "value": 5.0325375,
                  "description": "Linear function on the complete_description_elser_embedding field for the ben feature, computed as w * S from:",
                  "details": [
                    {
                      "value": 2.368253,
                      "description": "w, weight of this function",
                      "details": []
                    },
                    {
                      "value": 2.125,
                      "description": "S, feature value",
                      "details": []
                    }
                  ]
                }
              ]
            }
          ]
        }

Code 2:

GET /my-index/_search?explain=true
{
  "_source": {
    "excludes": [
      "complete_description_elser_embedding",
      "complete_description_vector"
    ]
  },
  "retriever": {
    "rrf": {
      "retrievers": [
        {
          "standard": {
            "query": {
              "match": {
                "query": "term"
              }
            }
          }
        },
        {
          "knn": {
            "field": "complete_description_vector",
            "query_vector": "${embedding}",
            "k": 10,
            "num_candidates": 10,
            "_name": "*** METHOD_KNN_EMBEDDINGS ***"
          }
        }
      ],
      "rank_constant": 1,
      "rank_window_size": 50
    }
  }
}

Explanation results from Code 2:
(seems like the correct and expected behavior)

      "matched_queries": [
          "*** METHOD_KNN_EMBEDDINGS ***"
        ],
        "_explanation": {
          "value": 0.5,
          "description": "rrf score: [0.5] computed for initial ranks [0, 1] with rankConstant: [1] as sum of [1 / (rank + rankConstant)] for each query",
          "details": [
            {
              "value": 0,
              "description": "rrf score: [0], result not found in query at index [0]",
              "details": []
            },
            {
              "value": 1,
              "description": "rrf score: [0.5], for rank [1] in query [*** METHOD_KNN_EMBEDDINGS ***] computed as [1 / (1 + 1]), for matching query with score: ",
              "details": [
                {
                  "value": 0.9523511,
                  "description": "within top k documents",
                  "details": []
                }
              ]
            }
          ]
        }
      },
      {