I’ve used the search.from_dict() to construct my query and received my results correctly.
es = Elasticsearch()
s = Search(using=es, index="logstash-*")
s = s.from_dict({
"query": {
"query_string": {
"query": "discord_event:message AND author.bot:false",
"analyze_wildcard": True
}
}
})
response = s.execute()
However, I can’t figure out how the proper syntax for:
Using QueryString
I have tried:
qs = QueryString(query="discord_event:message AND author.bot:false")
s = query(qs)
Doesn’t work.
Using time range to filter results
I have tried:
s = s.filter('range', timestamp={'gte': 'now-5m', 'lt': 'now'})
This gave zero results. In Kibana I did the same search with time range and am getting results.
Part of the reasons that I’d like to just use QS + time range is coz I am able to see my results in Kibana and would just like to plug in whatever I need after getting the correct results.
Any help would be greatly appeciated! I am using the Elasticsearch_DSL Python library btw.