# Fquery in python script

**URL:** <https://discuss.elastic.co/t/fquery-in-python-script/189461>\
**Category:** Elasticsearch\
**Created:** [July 9, 2019, 6:30am UTC](https://discuss.elastic.co/t/fquery-in-python-script/189461 "2019-07-09T06:30:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnm/32/49468_2.png) [@JohnM](https://discuss.elastic.co/u/JohnM)\
**Post date:** [July 9, 2019, 6:30am UTC](https://discuss.elastic.co/t/fquery-in-python-script/189461/1 "2019-07-09T06:30:46Z")

</div>

After upgrading Elasticsearch from 2.x to 7.x python script stopped working.  
Looks like fquery is no longer available after 6.x  
Could someone kindly tell me on how to convert fquery with a new syntax please?  
Thank you

```
gen_query = ({ "range":
 {"@timestamp":
   {
     "gte": timestamp_from,
     "lte": timestamp_to
   }
 }
},
{"fquery":
 {"query":
   {"query_string":
     {"query": host_query
     }
   },
 }
},
{"query":
 {"query_string":
   {"query": message_query
   }
 },
})
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 6, 2019, 6:30am UTC](https://discuss.elastic.co/t/fquery-in-python-script/189461/2 "2019-08-06T06:30:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
