Elasticsearch - recency boost error: 'Unknown key for a START_OBJECT in [boosts].'

I'm using the python elasticsearch api to hit a elasticsearch on some data that has the following fields:

"id", "dateCreated", "title", "text_body"

The "dateCreated" is of the form '2021-09-01T23:09:54.79362+00:00'

I'm running a query against elasticsearch as follows:

    body = {
        "query": {
            "multi_match": {
                "query": <query>,
                "fields": ['title^3', 'body']
            }
        },
        "boosts": {
            "dateCreated": {
                "type": "proximity",
                "function": "linear",
                "center": "now",
                "factor": 8
            }
        },
    }
    res = es.search(index=<index>, body=body)

When I run this I get the following error:

elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'Unknown key for a START_OBJECT in [boosts].')

I'm guessing it's having some issue with "dateCreated", but I'm not sure what. Any help would be much appreciated. Thanks!

Where did you find that use of boosts from?

This article: Search API boosts | Elastic App Search Documentation [7.14] | Elastic

Which I'm now realizing is under "app search". Are they different APIs? If so, how do we do boosting in the regaular elasticsearch API?

Yeah they are a layer on top of the standard Elasticsearch APIs :slight_smile:

You can use this boost` in the query DSL - Boosting query | Elasticsearch Guide [7.14] | Elastic