"boost" does not work for "term" request

I am running Elasticsearch 1.5.2 and trying the following query:

{
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "gender": "male"
              }
            }
          ]
        }
      },
      "query": {
        "bool": {
          "must": [
            {
              "match_all": {}
            }
          ],
          "should": [
            {
              "term": {
                "top_users": 1,
                "boost": 2
              }
            }
          ]
        }
      }
    }
  }
}

      

It's ok until I add "boost": 2 to the must-> term part. The full query is much more complicated, so I need to boost, but the remaining queries make no difference: ES returns a 400 error if the term query receives a boost argument:

QueryParsingException [[index_name] [_na] request is invalid, must start with start_object]

Any suggestions?

+3


source to share


1 answer


It should be like this :



{
  "query": {
    "filtered": {
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "gender": "male"
              }
            }
          ]
        }
      },
      "query": {
        "bool": {
          "must": [
            {
              "match_all": {}
            }
          ],
          "should": [
            {
              "term": {
                "top_users": {
                  "value": "1",
                  "boost": 2
                }
              }
            }
          ]
        }
      }
    }
  }
}

      

+2


source







All Articles