Elasticsearch sequential dates


(Simon Leighton) #1

I Asked this on stack overflow but I see searching around for some pointers
most questions are being directed back to the ES mailing lists so here I
go...

I am creating a hotel booking system using Elasticsearch and am trying to
find a way to return hotels that have a variable number of sequential dates
available (for example 7 days) across a range of dates

I am currently storing dates and prices as a child document to the hotel
but am unsure how to undertake the search or if it is even possible with my
current setup?

Thanks

Simon

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ac5e1690-1c4c-4971-a35b-02237cf0add5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Wondering if you should not index availability instead of indexing rooms. (I don't know how your documents look like BTW)

Let's say you create documents like

{
"hotel":"name",
"room":"A205",
"available": [ {
"from": "2014-02-13",
"to": "2014-02-14",
"days":2
}, {
"from": "2014-02-16",
"to": "2014-02-20",
"days":5
} ]
}

Could this help?
That say, I think you can compute days when running the query but it well be easier and probably more efficient to compute it at index time (so on client level).

WDYT?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 5 février 2014 at 10:33:38, Simon Leighton (simonwleighton@gmail.com) a écrit:

I Asked this on stack overflow but I see searching around for some pointers most questions are being directed back to the ES mailing lists so here I go...

I am creating a hotel booking system using Elasticsearch and am trying to find a way to return hotels that have a variable number of sequential dates available (for example 7 days) across a range of dates

I am currently storing dates and prices as a child document to the hotel but am unsure how to undertake the search or if it is even possible with my current setup?

Thanks

Simon

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/ac5e1690-1c4c-4971-a35b-02237cf0add5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/etPan.52f20bd0.189a769b.d955%40MacBook-Air-de-David.local.
For more options, visit https://groups.google.com/groups/opt_out.


(Simon Leighton) #3

Hi David,

I'm pulling in the room availability for an API so I'll only get
availability one date at a time hence why I'm thinking of using child
documents as to not need to constantly update the hotel data in the parent.
Each day has an individual price so I'm trying to find the cheapest block
of say 7 days (this is user specified so could be anywhere from 1 - 14).

Thanks
Simon

On Wednesday, 5 February 2014 10:00:48 UTC, David Pilato wrote:

Wondering if you should not index availability instead of indexing rooms.
(I don't know how your documents look like BTW)

Let's say you create documents like

{
"hotel":"name",
"room":"A205",
"available": [ {
"from": "2014-02-13",
"to": "2014-02-14",
"days":2
}, {
"from": "2014-02-16",
"to": "2014-02-20",
"days":5
} ]
}

Could this help?
That say, I think you can compute days when running the query but it
well be easier and probably more efficient to compute it at index time (so
on client level).

WDYT?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfrhttps://twitter.com/elasticsearchfr

Le 5 février 2014 at 10:33:38, Simon Leighton (simonwl...@gmail.com<javascript:>)
a écrit:

I Asked this on stack overflow but I see searching around for some
pointers most questions are being directed back to the ES mailing lists so
here I go...

I am creating a hotel booking system using Elasticsearch and am trying to
find a way to return hotels that have a variable number of sequential dates
available (for example 7 days) across a range of dates

I am currently storing dates and prices as a child document to the hotel
but am unsure how to undertake the search or if it is even possible with my
current setup?

Thanks

Simon

You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/ac5e1690-1c4c-4971-a35b-02237cf0add5%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b5bead0e-4118-41cf-b18e-eaca181d78bf%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #4

If you want to find the cheapest block, you should also index the 14 prices
for the availabilities.

Jörg

On Wed, Feb 5, 2014 at 11:19 AM, Simon Leighton simonwleighton@gmail.comwrote:

Hi David,

I'm pulling in the room availability for an API so I'll only get
availability one date at a time hence why I'm thinking of using child
documents as to not need to constantly update the hotel data in the parent.
Each day has an individual price so I'm trying to find the cheapest block
of say 7 days (this is user specified so could be anywhere from 1 - 14).

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGSubmyArBbWsDd51Kc4P%2BQFV5g-p%2Bsy6Nx6J-_BoookA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5