Skip to content

Add support for combined_fields (BM25F) #3996

@SViradiya-MarutiTech

Description

@SViradiya-MarutiTech

Use Case

Currently when i want to search number field with provided free search text using multi_match, I get number_format_exception. what we checked in latest version of Elastic Search(7.17) it is possible to search using combined_fields. As AWS does not support combined_fields, we can not use combined_fields and as multi_match has problem with number field, we would not be able to upgrade our AWS OpenSearch, Lets take example.

in my_index document, year field is number, When I wanted to search like below:

GET my_index/_search
{
  "query": {
    "multi_match": {
      "query": "2011 Toyota Corolla",
      "type": "cross_fields",
      "fields": [
        "year",
        "make",
        "model"
      ]
    }
  }
}

I got 400 Error:

{
    "error": {
        "root_cause": [
            {
                "type": "query_shard_exception",
                "reason": "failed to create query: For input string: \"2012 Toyota Corolla\"",
                "index_uuid": "dkHYbCuLSBKzHcwN3yQx6g",
                "index": "instant_offer"
            }
        ],
        "type": "search_phase_execution_exception",
        "reason": "all shards failed",
        "phase": "query",
        "grouped": true,
        "failed_shards": [
            {
                "shard": 0,
                "index": "instant_offer",
                "node": "-X63-ynlS92dLxcUHMoyjA",
                "reason": {
                    "type": "query_shard_exception",
                    "reason": "failed to create query: For input string: \"2012 Toyota Corolla\"",
                    "index_uuid": "dkHYbCuLSBKzHcwN3yQx6g",
                    "index": "instant_offer",
                    "caused_by": {
                        "type": "number_format_exception",
                        "reason": "For input string: \"2012 Toyota Corolla\""
                    }
                }
            }
        ]
    },
    "status": 400
}

When I remove year field from array of "fields", I got 200 Status code.

Feature Request

I would like to see combined_fields support in latest OpenSearch. So that we can resolve our problem.

GET my_index/_search
{
  "query": {
    "combined_fields": {
      "query": "2011 Toyota Corolla",
      "fields": [
        "year",
        "make",
        "model"
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    SearchSearch query, autocomplete ...etcenhancementEnhancement or improvement to existing feature or requestfeatureNew feature or requesthelp wantedExtra attention is neededlucene

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions