Get request for ElasticSearch DB

Dear all,

I was wondering if there are nodes to make retreive data (get requests) from ElasticSearch DB. If  not I understand that Elasticsearch has a RESTful API, that can be queried by JSON formed query. How can I use the KREST nodes in order to apply below simple query. 

Many thanks in advance.

Waseem

 

curl -XGET 'http://localhost:9200/index_name/_search' -d '
{
    "size": 5000,
    "query": {
        "filtered": {
            "query": {
                "match_all": {}
            },
            "filter": {
                "bool": {
                    "must": [
                        {
                            "range": {
                                "@timestamp": {
                                    "from": 1451044800000,
                                    "to": 1451908800000,
                                    "include_lower": true,
                                    "include_upper": false
                                },
                                "execution": "fielddata"
                            }
                        },
                        {
                            "term": {
                                "type": "rawdata"
                            }
                        }
                    ]
                }
            }
        }
    },
    "fields": [
        "machine", "name", "value", "@timestamp"
    ]
}'

This seems pretty straightforward with the KNIME Labs REST nodes. May I ask why do you need KREST? (KREST nodes are no longer maintained.) Is it because KREST nodes let you more easily convert the result to table? (For JSON the JSON Path and JSON to Table nodes might be an option too.)

Thanks, gabor

Hi Gabor,

Thanks for your reply.

Actually, I'm not stick to anything, it's just that I'm not familiar of how should I do it.

I was trying to do it using KNIME Labs REST with no success. I have set the URL in the "GET Request" but I didn't know how to set the request body, such as the one included in my first comment. It would be very appreciated if you can give your advice.

 

Thanks, Waseem

Hi Waseem,

According to the manual, you should just append the data (probably URL encododed) to the URL with a ? inbetween. That way, this should work with the KNIME Labs REST GET node too.

Cheers, gabor

Thanks Gabor.

I see your solution, first I will need to learn how to encode nested Json into URL string.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.