Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include better output in profiling & toString for automaton based queries #105468

Merged

Conversation

benwtrent
Copy link
Member

We have various automaton based queries that build particular automatons based on their usage. However, the input text isn't part of the toString output, nor the usage of the current query (wildcard, prefix,etc.).

This commit adds a couple of simple queries to wrap some of our logic to make profiling and other output more readable.

Here is an example without this change:

#(-(winlog.event_data.TargetUserName:AutomatonQuery {
org.apache.lucene.util.automaton.Automaton@2d13c057} winlog.event_data.TargetUserName:AutomatonQuery {
org.apache.lucene.util.automaton.Automaton@28daf002} winlog.event_data.TargetUserName:AutomatonQuery {
org.apache.lucene.util.automaton.Automaton@43c3d7f8} winlog.event_data.TargetUserName:AutomatonQuery {
org.apache.lucene.util.automaton.Automaton@2f52905} winlog.event_data.TargetUserName:AutomatonQuery {
org.apache.lucene.util.automaton.Automaton@31d75074})

We have 5 case-insensitive automatons, but we don't know which is which in the profiling output. All we know is the originating field.

I don't think we can update AutomatonQuery directly as sometimes the automaton created mutates the term (prefix for example) and we lose that we are searching for a prefix.

@benwtrent benwtrent added >enhancement :Search/Search Search-related issues that do not fall into other categories v8.13.0 labels Feb 13, 2024
@elasticsearchmachine elasticsearchmachine added the Team:Search Meta label for search team label Feb 13, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@elasticsearchmachine
Copy link
Collaborator

Hi @benwtrent, I've created a changelog YAML for you.

Copy link
Member

@carlosdelest carlosdelest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@benwtrent
Copy link
Member Author

@elasticmachine update branch

@benwtrent benwtrent added the auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Feb 14, 2024
@elasticsearchmachine elasticsearchmachine merged commit a874f47 into elastic:main Feb 14, 2024
14 checks passed
@benwtrent benwtrent deleted the feature/improve-profiling-output branch February 14, 2024 13:46
@javanna
Copy link
Member

javanna commented Feb 15, 2024

shouldn't we have tests added to verify the change in behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >enhancement :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants