title: Passing the JSON params as kwargs in Python
body: <p>I have some post data of the format</p>
  
  <pre><code>d = {
      "filters": [
          {
              "type": "range",
              "question__created_at": "2014-11-10T11:11:55.027Z",
              "exclude_filter": False,
  
          },
          {
              "type": "terms",
              "question_name": ["AB","CD"]
              "exclude_filter": False,
  
          }
      ],
      "count": True
  }
  </code></pre>
  
  <p>What I am trying to achieve here is the I pick the value of the every filter type from the key "type" of each filter dictionary. And I send the rest of all the fields as kwargs and that will directly be passed to the query that I am appending these filters.</p>
  
  <p>So here is the query that will be appended based on the the number of filters I pass:</p>
  
  <pre><code>s = Search(using=es).index(settings.ES_INDEX).doc_type(model)
  </code></pre>
  
  <p>This is the default elasticsearch that is like a match all query on my db.</p>
  
  <p>When I pass the above filter(JSON) and in this case when I have 2 filters passed , below is what my modified query should look like:</p>
  
  <pre><code>s = Search(using=es).index(settings.ES_INDEX).doc_type(model)
  
  s = s.filter(
      F('range', question__created_at="2014-11-10T11:11:55.027Z", exclude_filter=True) &amp;
      F('terms', question_name=["AB","CD"], exclude_filter=True))
  </code></pre>
  
  <p>So, depending on any number of filters passed it should dynamically go on to append them with the "s" object</p>
  
  <p>Can anyone help on how I can write a function in python that picks up the filter type separate and rest of it as kwargs so that I can unpack everything directly to the query?</p>