Querying for a range of dates.
See original GitHub issueHello Honza, I’m hoping you might be able to help me out with one last issue i’m having. I need to query for all articles that have 404 errors as a response field and I also need to find all of them from withing the lasts 15 inutes. The issues show up inside of Kibana but they are not showing in my queries.
I’ve been having a really hard time getting this to work and there aren’t any clear examples of querying in a specific range of time in the docs. Here’s my script.
s = Search(using=es, index= "_all") \
.query("match", response = "404")\
.filter('range', timestamp={'from': datetime.datetime.now() - datetime.timedelta(minutes=15), 'to' : datetime.datetime.now() }) #, 'lte': datetime(2010, 10, 9)})
#.filter("range", '@timestamp': {"gte": "now-15m", "lte": "now"}) #, "lt" : "2014-12-31 1:00:00"})
#filter is for a range of possible times.
#.filter("range", timestamp={ "gt":"now -5m","lt":"now" })
response = s.execute()
Issue Analytics
- State:
- Created 9 years ago
- Reactions:4
- Comments:22 (10 by maintainers)
Top Results From Across the Web
How do I write a SQL query for a specific date range and date ...
For example, I want to query all the rows from 5:00PM on 16-Sep-2010 to 9:00AM on 21-Sep-2010. Any ideas as to how the...
Read more >How to Write a SQL Query For a Specific Date Range and ...
SELECT * FROM TABLE_NAME WHERE DATE_TIME_COLUMN BETWEEN 'STARTING_DATE_TIME' AND 'ENDING_DATE_TIME';. Step 1: Create a Database. For this use ...
Read more >Selecting records between two date range query - Plus2net
Records of different date ranges by using DATE_SUB(), CURDATE() and BETWEEN() query.
Read more >Examples of using dates as criteria in Access queries
Here are some common date criteria examples, ranging from simple date filters to more complex date range calculations. Some of the more complex...
Read more >SQL BETWEEN Operator - W3Schools
The BETWEEN operator selects values within a given range. The values can be numbers, text, or dates. The BETWEEN operator is inclusive: begin...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No, this is neither a logstash problem, nor is it a problem with the library. You are missing
**
in front of the dict, it should be:Also please stop appending questions to this ticket, this is really not the place to help you and I will not respond to any more questions here. Feel free to contact me another way. Thank you
use
**{'@timestamp': {'gte': 'now-5m' , 'lt': 'now'}}