Conditionals for timefield in Timelion

(Luvpreet Singh) #1

I have 4 different types in an index.

One type is booking, and one is User.

Booking has booking_time as a timefield, and User has a date_joined field as a timefield.

I want to draw bookings when User's date_joined is greater than some date.

.es(index='prod-db', timefield='booking_time', q='_type:booking'), .es(index='prod-db', timefield='booking_time', q='_type:booking').if(gt,now-6d,.es(index='prod-db', q='_type:user', timefield='user_date_joined'))

I have tried this and this does not work for me. It says, Timelion: Error: in cell #1: must be a number or a seriesList

how can I achieve this ? How can I query conditionals on Timefields in Timelion?

(Spencer Alger) #2

It sounds like you are trying to join the data from the bookings with the data from the users, but I'm pretty sure that's not possible even in Timelion. It sounds like you ultimately want to draw bookings, and you want to filter bookings based on the user's date_joined property. In order to do this you'll have to index this data together, like so:

{ "index": { "_type": "booking" } }
{ "booking_time": "...", "users_date_joined": "...", ... other fields ... }

(Luvpreet Singh) #3

Hi @spalger ,

I have indexed the data as you have said. I have the user_date_joined in my index under booking type.

How should I put the conditionals now ?

Can you give an example ?

(system) #4

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