title: Elastic Search Function_Score Query with Query_String
body: <p>I was doing search using elastic search using the code:</p>
  
  <pre><code>es.search(index="article-index", fields="url", body={
    "query": {
      "query_string": {
        "query": "keywordstr",
        "fields": [
          "text",
          "title",
          "tags",
          "domain"
        ]
      }
    }
  })
  </code></pre>
  
  <p>Now I want to insert another parameter in the search scoring - "recencyboost".</p>
  
  <p>I was told function_score should solve the problem</p>
  
  <pre><code>res = es.search(index="article-index", fields="url", body={
    "query": {
      "function_score": {
        "functions": {
          "DECAY_FUNCTION": {
            "recencyboost": {
              "origin": "0",
              "scale": "20"
            }
          }
        },
        "query": {
          {
            "query_string": {
              "query": keywordstr
            }
          }
        },
        "score_mode": "multiply"
      }
    }
  })
  </code></pre>
  
  <p>It gives me error that dictionary <code>{"query_string": {"query": keywordstr}}</code> is not hashable.</p>
  
  <p>1) How can I fix the error?</p>
  
  <p>2) How can I change the decay function such that it give higher weight to higher recency boost?</p>