Skip to content

Validate default similarity parameters strictly #29035

@eskibars

Description

@eskibars

Elasticsearch version (bin/elasticsearch --version): 6.2.0

JVM version (java -version): 1.8

OS version (uname -a if on a Unix-like system): OSX

Description of the problem including expected versus actual behavior:

Steps to reproduce:

PUT test
{
  "settings": {
    "index" : {
        "similarity" : {
          "default" : {
            "type" : "bm25"
          }
        }
    }
  }
}

Produces the expected: "Unknown Similarity type [bm25] for [default]" since type needs to be BM25. However (at least for BM25 and classic), it's happy to accept/acknowledge arbitrary parameters that may not exist:

PUT test
{
  "settings": {
    "index" : {
        "similarity" : {
          "default" : {
            "type" : "BM25",
            "foo": "bar"
          }
        }
    }
  }
}

Validates even though there's obviously no foo parameter. I had a situation where I had a typo of k instead of k1 and I was thrown off for a little too long trying to figure out why my k value wasn't taking hold. It'd be great if we could strictly validate and error out as early as possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions