Using constant_score to avoid TF-IDF

Hi,

I have a use case of resume screening candidates based on job description keywords. Since I cannot afford change in score each time a new candidate profile is added to the content list (I assume IDF will change), I want to omit TF_IDF. As per the documentation, I created this query

{
  "query": {
    "bool": {
      "should": [
        { "constant_score": {
          "query": { "match": { "description": "corporate strategy" }}
        }},
        { "constant_score": {
          "query": { "match": { "description": "strategy consulting" }}
        }},
        { "constant_score": {
          "query": { "match": { "description": "international strategy" }}
        }},
        { "constant_score": {
          "query": { "match": { "description": "MBA" }}
        }}
      ]
    }
  }
}

The issue is I am getting error

[constant_score] query does not support [query]

All I want is a simple score of 1 for single-or-n occurrence for each term. Any help is appreciated.

SOLVED.

The documentation was for 2.x version. As per 6.4.x version, following should work

{
  "query": {
    "bool": {
      "should": [
        { "constant_score": {
          "filter": { "match": { "description": "corporate strategy" }}
        }},
        { "constant_score": {
          "filter": { "match": { "description": "strategy consulting" }}
        }},
        { "constant_score": {
          "filter": { "match": { "description": "international strategy" }}
        }},
        { "constant_score": {
          "filter": { "match": { "description": "MBA" }}
        }}
      ]
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.