Skip to content

Conversation

@felixbarny
Copy link
Member

@felixbarny felixbarny commented Oct 15, 2025

Previously, we were converting literal label filters starting or ending with one of .* and .+ to a prefix/suffix query. However, .+ implies that there's at least more character. This is also known as a "proper prefix" or "proper suffix". In other words, it's a prefix or suffix but not the term itself.

Seems like we don't have a builtin functionality for proper prefix/suffix matching, so this translates it to new And(source, new NotEquals(source, field, value), new StartsWith(source, field, value)).

I can work separately on adding a parameter to STARTS_WITH/ENDS_WITH or creating dedicated functions like PROPER_PREFIX/SUFFIX or something like that (as a PR on targeting main). Once that is in, I'll go back and change this. I don't think this PR would be blocked on that, though.

@felixbarny felixbarny requested a review from costin October 15, 2025 07:15
@felixbarny felixbarny self-assigned this Oct 15, 2025
@felixbarny felixbarny added >non-issue :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL labels Oct 15, 2025
@elasticsearchmachine elasticsearchmachine added Team:StorageEngine external-contributor Pull request authored by a developer outside the Elasticsearch team labels Oct 15, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@felixbarny felixbarny linked an issue Oct 15, 2025 that may be closed by this pull request
@felixbarny
Copy link
Member Author

I've created an issue for adding first-class support for proper prefix/suffix queries to ES|QL: #136615

@felixbarny felixbarny force-pushed the promql-proper-prefix branch from 79d8e08 to 210c6d2 Compare October 29, 2025 09:14
@felixbarny felixbarny merged commit 2775c2d into elastic:esql/promql Oct 29, 2025
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor Pull request authored by a developer outside the Elasticsearch team >non-issue :StorageEngine/ES|QL Timeseries / metrics / logsdb capabilities in ES|QL Team:StorageEngine

2 participants