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 <
[email protected]> 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 
>> <[email protected]>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 [email protected].
>>> To view this discussion on the web visit https://groups.google.com/d/
>>> msgid/elasticsearch/fb4a3d83-c386-459b-beb6-a8ca4fcbb286%
>>> 40googlegroups.com<https://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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/ec1fa45f-4534-45a2-96ae-1d5edf783ac4%40googlegroups.com<https://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 [email protected].
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.

Reply via email to