elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.17k stars 24.84k forks source link

ESQL: Result cache #104211

Open nik9000 opened 10 months ago

nik9000 commented 10 months ago

Description

_search has a lovely cache that can make certain agg requests very fast because we can serve them from memory. Specifically, the index has to be the same and the query has to be the same modulo some rewrites. ESQL has nothing like this and probably should.

elasticsearchmachine commented 10 months ago

Pinging @elastic/es-analytics-geo (Team:Analytics)

philippkahr commented 3 months ago

Assuming I do the following:

from logs-*
| where host LIKE "a*b"
| dissect message "%{} authenticated using NTLM %{version}"
| keep @timestamp, host, version

Now I want this to be a line chart showing me the amount of NTLM auths depending on the version. Next to the line chart I want to see a table with host + login timestamp + version.

That means I need to copy and paste and run the same ESQL command twice.

If I think about this, I might have 5,10,15 visualisations that are based off of the same ESQL command, just showing different flavors.

What I would love to do because of this is:

nik9000 commented 3 months ago

If I think about this, I might have 5,10,15 visualisations that are based off of the same ESQL command, just showing different flavors.

I think this is a separate, but related, thing to caching. ES|QL doesn't have lovely request cache and it really could, but probably only for some queries. We could make that work. We have a whole language there, after all.

I think what you are talking about is sort of "custom commands". I'd love for you to be able to, say, make a function that is those commands. So you could do, like, MY_FROM_NTML_LOGS and it is those four lines.

Now these custom commands and caching sort of come together in the world of materialized views.

I want all three of these things.