bagui
(bagui)
June 4, 2014, 11:43am
1
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 elasticsearch+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/f596658e-5ec4-42ac-abc1-4f99416be101%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .
spinscale
(Alexander Reelsen)
June 16, 2014, 12:13pm
2
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:
Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
--Alex
On Wed, Jun 4, 2014 at 1:43 PM, Subhadip Bagui i.bagui@gmail.com 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 elasticsearch+unsubscribe@googlegroups.com .
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 elasticsearch+unsubscribe@googlegroups.com .
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 .
bagui
(bagui)
June 16, 2014, 12:27pm
3
Hi Alex,
Yes I tried that and it's working. Thanks
--
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/8addde47-a57b-4a4a-aa7a-68b419bcf90e%40googlegroups.com .
For more options, visit https://groups.google.com/d/optout .