Hey,

did you try something along the
lines FilterBuilders.rangeFilter("@timestamp").from("now").to("now - 5d") -
did that pose problems?

make sure you are reading this paragraph about date range filters:
http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/filter-caching.html


--Alex


On Wed, Jun 4, 2014 at 1:43 PM, Subhadip Bagui <[email protected]> wrote:

> Hi,
>
> I have a document like below
>
> {
>             "_index": "cpu_usage_metrics",
>             "_type": "cpu_usage_metrics",
>             "_id": "CKAAs1n8TKiR6FncC5NLGA",
>             "_score": 1,
>             "_source": {
>                "status": 0,
>                "occurrences": 1,
>                "value": "33",
>                "key": "vm.server2.cpu.usage",
>                "client": "vm.server2",
>                "@timestamp": "2014-06-03T20:18:19+05:30",
>                "check_name": "cpu_usage_metrics",
>                "address": "10.203.238.138",
>                "command": "cpu-usage-metrics.sh"
>             }
>      }
>
>  I want to do a filtered query with time range using java api like below
>
> "filter": {
>                 "range": {
>                     "@timestamp": {
>                          "to": "now",
>                         "from": "now - 5mins"
>                     }
>                 }
>             }
>
>
> Please suggest how to form the Filter in java api.
>
> Thanks,
> Subhadip
>
>  --
> 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/f596658e-5ec4-42ac-abc1-4f99416be101%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/f596658e-5ec4-42ac-abc1-4f99416be101%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/CAGCwEM_YymPLyoy2nVmk9VAeq2RFHu7mJtufhBHCGd5Q6u9ZUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to