Query documents using multiple time fields

Hi,

I know that today its possible to query for documents using a specific single time field, but I was wondering if its possible to query for documents that the query time range falls between two other time fields.

Example:
Lets say I have a document that have a document that represents a user sessions like this:

{
  startTime: "2017-06-07T08:30:00.000Z",
  endTime: "2017-06-07T09:30:00.000Z"
}

Yes, I think you can do that in 2 different ways.

In Kibana query bar;

startTime:[2017-06-07T08:30:00.000Z TO *] AND endTime:[* TO 2017-06-07T09:30:00.000Z]

Or if you were looking for a range query you could do something like this;

        {
          "range": {
            "startTime": {
              "gte": "2017-06-14T16:20:04.834Z",
            }
          },
        {
          "range": {
            "endTime": {
              "lt": "2017-06-19T17:24:42.631Z"
            }
          },
        },
1 Like

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