ESQL: Fix constant keyword optimization#129278
Conversation
Fixes the ESQL's detection of `constant_keyword` fields. We unplugged it when we changed a function signature because we didn't have an `@Override` annotation. This plugs it back in and adds it to the integration tests we use for pushing queries to lucene. When you do `| WHERE constant_keyword_field == "itsvalue"` then the whole is removed from the query plan because *all* documents are equal.
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
|
Hi @nik9000, I've created a changelog YAML for you. |
|
|
||
| @Override | ||
| public String toString() { | ||
| return "LocalSourceOperator"; |
There was a problem hiding this comment.
Fix the signature rendering for the test.
| case "match_only_text", "semantic_text" -> true; | ||
| ComputeSignature dataNodeSignature = switch (type) { | ||
| case "auto", "constant_keyword", "text" -> ComputeSignature.FILTER_IN_QUERY; | ||
| case "match_only_text", "semantic_text" -> ComputeSignature.FILTER_IN_COMPUTE; |
There was a problem hiding this comment.
Because I was changing a bunch of stuff I put these in alphabetical order while I went. We're going to keep adding stuff to this in the next few months, I think. So sorted order helps.
| String val = null; | ||
| for (SearchExecutionContext ctx : contexts) { | ||
| MappedFieldType f = ctx.getFieldType(name); | ||
| MappedFieldType f = ctx.getFieldType(name.string()); |
There was a problem hiding this comment.
Real fix is all in this file.
|
I'm going to add |
alex-spies
left a comment
There was a problem hiding this comment.
Ooh, this is such a nice test improvement. Thanks a lot @nik9000 !
|
oooh conflicts! working |
|
@nik9000 , I think we forgot the |
|
Ah, yeah. I thought I had put backport-pending. It's running locally now |
Fixes the ESQL's detection of `constant_keyword` fields. We unplugged it when we changed a function signature because we didn't have an `@Override` annotation. This plugs it back in and adds it to the integration tests we use for pushing queries to lucene. When you do `| WHERE constant_keyword_field == "itsvalue"` then the whole is removed from the query plan because *all* documents are equal.
|
Backport: #129354 |
* ESQL: Fix constant keyword optimization (#129278) Fixes the ESQL's detection of `constant_keyword` fields. We unplugged it when we changed a function signature because we didn't have an `@Override` annotation. This plugs it back in and adds it to the integration tests we use for pushing queries to lucene. When you do `| WHERE constant_keyword_field == "itsvalue"` then the whole is removed from the query plan because *all* documents are equal. * Old lucene is different
Fixes the ESQL's detection of
constant_keywordfields. We unplugged it when we changed a function signature because we didn't have an@Overrideannotation. This plugs it back in and adds it to the integration tests we use for pushing queries to lucene. When you do| WHERE constant_keyword_field == "itsvalue"then the whole is removed from the query plan because all documents are equal.