Searching most recent objects


(Joris Bolsens) #1

I am using the javascript API and want to do a search and have it search
through the most recent objects, IE I call a search with size 100, I want
to have the most recent 100 objects returned to me, how would I go about
doing that?

I tried using sort, but it seems that it just sorts the results after the
search completed

--
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/e25a78e9-c126-439e-ad53-0547de3b358d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Phil Greenberg) #2

I am also facing the same issue.

Right now, I am just doing a filter myself, but I would assume this is a
common use case, an ES must have a way to deal with it?

On Tuesday, April 15, 2014 6:24:52 PM UTC-7, Joris Bolsens wrote:

I am using the javascript API and want to do a search and have it search
through the most recent objects, IE I call a search with size 100, I want
to have the most recent 100 objects returned to me, how would I go about
doing that?

I tried using sort, but it seems that it just sorts the results after the
search completed

--
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/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Itamar Syn-Hershko) #3

Filter (range filter on the date/time field) is exactly the way to do this.

Another possibility is using rolling indexes (e.g. an index per day, like
the logstash indexes are defined) but that obviously depends on a lot of
other business concerns and isn't really viable for most applications

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:36 AM, Phil Greenberg <
philip.n.greenberg@gmail.com> wrote:

I am also facing the same issue.

Right now, I am just doing a filter myself, but I would assume this is a
common use case, an ES must have a way to deal with it?

On Tuesday, April 15, 2014 6:24:52 PM UTC-7, Joris Bolsens wrote:

I am using the javascript API and want to do a search and have it search
through the most recent objects, IE I call a search with size 100, I want
to have the most recent 100 objects returned to me, how would I go about
doing that?

I tried using sort, but it seems that it just sorts the results after the
search completed

--
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/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHTr4Zu9B78T_aOECERuo0THM29fs%3DVXavesSC4n2P7rFRFBtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Phil Greenberg) #4

Thanks Itamar.

So are you saying it's not possible to ask ES for the most recent X objects
that match the given query? Only to say give me the last 30 days of
objects?

On Thursday, April 17, 2014 2:39:43 PM UTC-7, Itamar Syn-Hershko wrote:

Filter (range filter on the date/time field) is exactly the way to do this.

Another possibility is using rolling indexes (e.g. an index per day, like
the logstash indexes are defined) but that obviously depends on a lot of
other business concerns and isn't really viable for most applications

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:36 AM, Phil Greenberg <philip.n....@gmail.com<javascript:>

wrote:

I am also facing the same issue.

Right now, I am just doing a filter myself, but I would assume this is a
common use case, an ES must have a way to deal with it?

On Tuesday, April 15, 2014 6:24:52 PM UTC-7, Joris Bolsens wrote:

I am using the javascript API and want to do a search and have it search
through the most recent objects, IE I call a search with size 100, I want
to have the most recent 100 objects returned to me, how would I go about
doing that?

I tried using sort, but it seems that it just sorts the results after
the search completed

--
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/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Itamar Syn-Hershko) #5

For recent X just sort on the _timestamp field and specify X as the page
size
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:43 AM, Phil Greenberg <
philip.n.greenberg@gmail.com> wrote:

Thanks Itamar.

So are you saying it's not possible to ask ES for the most recent X
objects that match the given query? Only to say give me the last 30 days
of objects?

On Thursday, April 17, 2014 2:39:43 PM UTC-7, Itamar Syn-Hershko wrote:

Filter (range filter on the date/time field) is exactly the way to do
this.

Another possibility is using rolling indexes (e.g. an index per day, like
the logstash indexes are defined) but that obviously depends on a lot of
other business concerns and isn't really viable for most applications

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:36 AM, Phil Greenberg philip.n....@gmail.comwrote:

I am also facing the same issue.

Right now, I am just doing a filter myself, but I would assume this is a
common use case, an ES must have a way to deal with it?

On Tuesday, April 15, 2014 6:24:52 PM UTC-7, Joris Bolsens wrote:

I am using the javascript API and want to do a search and have it
search through the most recent objects, IE I call a search with size 100, I
want to have the most recent 100 objects returned to me, how would I go
about doing that?

I tried using sort, but it seems that it just sorts the results after
the search completed

--
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.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%
40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/CAHTr4ZuNk-5HOLmbv4xutsUiGRuntUtcwEi%2BOK_4r698ixygYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Phil Greenberg) #6

Oh, awesome, thank you so much for the help, I'll give that a try!

On Thursday, April 17, 2014 2:51:23 PM UTC-7, Itamar Syn-Hershko wrote:

For recent X just sort on the _timestamp field and specify X as the page
size
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-timestamp-field.html

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:43 AM, Phil Greenberg <philip.n....@gmail.com<javascript:>

wrote:

Thanks Itamar.

So are you saying it's not possible to ask ES for the most recent X
objects that match the given query? Only to say give me the last 30 days
of objects?

On Thursday, April 17, 2014 2:39:43 PM UTC-7, Itamar Syn-Hershko wrote:

Filter (range filter on the date/time field) is exactly the way to do
this.

Another possibility is using rolling indexes (e.g. an index per day,
like the logstash indexes are defined) but that obviously depends on a lot
of other business concerns and isn't really viable for most applications

--

Itamar Syn-Hershko
http://code972.com | @synhershko https://twitter.com/synhershko
Freelance Developer & Consultant
Author of RavenDB in Action http://manning.com/synhershko/

On Fri, Apr 18, 2014 at 12:36 AM, Phil Greenberg <philip.n....@gmail.com

wrote:

I am also facing the same issue.

Right now, I am just doing a filter myself, but I would assume this is
a common use case, an ES must have a way to deal with it?

On Tuesday, April 15, 2014 6:24:52 PM UTC-7, Joris Bolsens wrote:

I am using the javascript API and want to do a search and have it
search through the most recent objects, IE I call a search with size 100, I
want to have the most recent 100 objects returned to me, how would I go
about doing that?

I tried using sort, but it seems that it just sorts the results after
the search completed

--
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.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%
40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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/53cdd542-4d17-47b9-bedb-3d2f6937864d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #7