title: Updating Elasticsearch Query parameter in Python
body: <p>I am querying elasticsearch in python. I want to change a parameter 'default operator' in case query returns zero values.
  Here's my code:</p>
  <blockquote>
  <pre><code>default_operator = &quot;and&quot;
  if searchfields is not None:
      if query is not None and query != '':
          queries.append(Q(&quot;simple_query_string&quot;, query=query, default_operator= default_operator,
                          flags=&quot;PREFIX|PHRASE|NOT|AND|OR|FUZZY|WHITESPACE&quot;, fields=searchfields))
  </code></pre>
  </blockquote>
  <p>There is a long code after this in which different filters are being made and added to the query. But here's the code where I am trying to change the default operator:</p>
  <blockquote>
  <pre><code>res = s.execute()
  if res[&quot;hits&quot;][&quot;total&quot;][&quot;value&quot;] == 0:
     default_operator = &quot;or&quot;
     print(&quot;Query with default operator OR: &quot;, str(queries))
     res = s.execute()
  else:
    pass
  </code></pre>
  </blockquote>
  <p>But it is not changing the default operator. How can I do this?</p>