ElasticSearch query

Hello,

I’m trying to use the ElasticSearch node. This is the query I’d like to use, however I don’t understand how should I use it in the n8n node. Any idea?

Thanks!

Hi @alexsonnay, when hovering over the Query field you should see a tooltip pointing to Query DSL | Elasticsearch Guide [8.1] | Elastic for more information on how the query should look like:

image

For example, if you’re looking for documents where the response field has a value of 200, you could run a query like this:

{
    "query": {
        "match": {
            "response": 200
        }
    }
}

I am not sure if the underlying endpoint supports aggregations like in your screenshot though, this would require a closer look. Might be worth simply testing and sending your example payload (starting in line 2), just make sure to specify the index you are querying (users form the looks of it) in the respective n8n field.

You can always use the HTTP Request node as a fallback to send the exact payload to you have in mind to any REST endpoint.

Hope this helps!

So Index should be users?
How can I specify than I’m looking to use _search endpoint though?
I just copy pasted the request that I tested on Kibana.

I tried and this doesn’t output any data.

Is there a way to use an URL like on this screen? If not, how can I use it this way?

Made it work with the HTTP module in the end. Thanks!

1 Like

Awesome, glad to hear this worked out!