Gauti
(Gautham)
February 1, 2021, 5:48pm
1
Hi All,
I am trying to export data from elasticsearch using rest api
below is an example which got succeeded, but this will give complete data present in index
URL : http://dashboard.iff.com:9200/inctable/_search/
How do i pull data for last 30 days using the rest API.
Any advice please.
Thanks
Gautham
warkolm
(Mark Walkom)
February 1, 2021, 8:09pm
2
Use a filter with a date range and you should be good to go - Range query | Elasticsearch Reference [7.10] | Elastic
Gauti
(Gautham)
February 2, 2021, 4:51am
3
@warkolm I'm able to get this in dev tools, but how do i convert it as a rest URL?
Thanks
Gautham
ahmadimt07
(Imteyaz Ahmad)
February 2, 2021, 6:20am
4
in dev tools, there is an option called "Copy as curl" (available after clicking on wrench button beside the execute button), where you can get the rest URL. It will give you something like this:
curl -XGET "http://localhost:9200/test_index/_search" -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"stats_agg": {
"stats": {
"field": "time"
}
}
}
}'
Gauti
(Gautham)
February 2, 2021, 6:36am
5
Curl is fine, but i need it as a direct rest URL, like the one i mentioned below,
http://dashboard.iff.com:9200/inctable/_search/
can we add the aggs directly into an URL
Thanks
Gautham
ahmadimt07
(Imteyaz Ahmad)
February 3, 2021, 10:10am
6
AFAIK...that can not be done. If you find something, please post it here.
1 Like
system
(system)
Closed
March 3, 2021, 10:10am
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.