Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to store dates/times in RediSearch

I've read that RediSearch has support for dates and times via the "numeric" type, but there's not much information about this. Does this mean I just choose my own conversion from time, such as seconds since 1970?

like image 746
mahemoff Avatar asked Oct 01 '18 20:10

mahemoff


People also ask

What is redisearch and how does it work?

What is RediSearch? RediSearch provides secondary indexing, full-text search, and a query language for Redis. These feature enable multi-field queries, aggregation, exact phrase matching, and numeric filtering for text queries. What it essentially means for a developer is that you can now run SQL like queries for text search on redis and much more.

How to store dates for later?

Alternatively, place the dates in a resealable plastic bag. Squeeze out the air and seal the bag. Store semi-dry dates at room temperature. Place the dates in the pantry, or on your kitchen counter. Make sure they are out of direct sunlight if you place them on the counter. Store them away from the stove and oven as well. [2]

Can redisearch index and query JSON documents?

When combined with the RedisJSON module, which is included with Redis Stack, RediSearch can index and query JSON documents. To learn how to use RediSearch with JSON documents, see Indexing JSON documents.

How do you store Zahidi dates?

Place the dates in the pantry, or on your kitchen counter. Make sure they are out of direct sunlight if you place them on the counter. Store them away from the stove and oven as well. Deglet Noor and Zahidi dates are considered semi-dry dates.


1 Answers

Yep, exactly that (a.k.a epoch and timestamp).

You can also define your own epoch and timestamp resolution if you want, like "days since January 1 2018", as long as you convert to and from real times.

Also, the aggregation API has a bunch of functions augmenting dealing with timestamps. See https://oss.redislabs.com/redisearch/Aggregations/#list%22_%22of%22_%22datetime%22_%22apply%22_%22functions

like image 181
Itamar Haber Avatar answered Oct 03 '22 12:10

Itamar Haber