Forum Discussion

mysterylie's avatar
mysterylie
Icon for Bronze I rankBronze I
12 days ago

Introduction To Elastic: Ep.9 – ES|QL

I'm stuck on questions 13 and 15. My eval statement seems to be working, and I thought it was fairly straight-forward overall but the values returned are not being accepted. I noticed there was a default limit of 500 being set, so I tried manually added a limit of 255000 to make sure all results are calculated but this still doesn't work. I tried expanding the date range back a year leading to present, but that didn't work. 

I'm using to_long() for the conversions. I managed to get #13 by guess/checking, but I don't even see the correct value in the list of values I'm looking at. It's in the right range, however, so it makes me think I'm doing this mostly correct. 

Not sure what else to include here without providing too many spoilers. Let me know what you need. 

  • sorry, I haven't saved any informations on that one. maybe I have some time end of the week for that one.

  • So, this one took me some time to work out as well, I'm not sure I can provide any tips without giving the answer. 

    The query I used for 13 was - "from nyc-taxis | eval elaspsed_time = to_long(dropoff_datetime) - to_long(pickup_datetime) | sort elasped_time desc" This will then give you the logs sorted with the longest elasped_time first. 

    For 15 I used the query - "from nyc-taxis | eval elasped_time = to_long(dropoff_datetime) - to_long(pickup_datetime) | eval average_speed = trip_distance / elasped_time * 3600000 | sort elasped_time desc"

    There may be cleaner ways of doing it or easier ways but that is how I managed to get the correct results. 

    Hope that helps