Scripted keyword field#58939
Conversation
| private final LeafReaderContext ctx; | ||
| private final SourceLookup source; | ||
| private final LeafDocLookup fieldData; | ||
| private final LeafSearchLookup leafSearchLookup; |
| public AbstractScriptFieldScript(Map<String, Object> params, SourceLookup source, DocLookup fieldData, LeafReaderContext ctx) { | ||
| public AbstractScriptFieldScript(Map<String, Object> params, SearchLookup searchLookup, LeafReaderContext ctx) { | ||
| this.leafSearchLookup = searchLookup.getLeafSearchLookup(ctx); | ||
| //TODO how do other scripts get stored fields exposed? Through asMap? I don't see any getters for them. |
There was a problem hiding this comment.
Yeah, they have them exposed in weird ways that I don't feel comfortable copying. I'd prefer to make a getter for them.
| IndexNameExpressionResolver indexNameExpressionResolver, | ||
| Supplier<RepositoriesService> repositoriesServiceSupplier) { | ||
| //looks like createComponents gets called after getMappers | ||
| this.scriptTypeParser.setScriptService(scriptService); |
There was a problem hiding this comment.
That is kind of nasty. Not a blocker for the PR, and maybe not a blocker ever, but a little sad!
There was a problem hiding this comment.
yea this caught me by surprise. Though it was not hard to work around.
| return null; | ||
| } | ||
| // keywords are internally stored as utf8 bytes | ||
| BytesRef binaryValue = (BytesRef) value; |
There was a problem hiding this comment.
I think our keywords come out as strings though, right? When does this get called?
There was a problem hiding this comment.
no idea, this is copied from the keyword field....
|
|
||
| @Override | ||
| protected void parseCreateField(ParseContext context) { | ||
| //there is no field! |
There was a problem hiding this comment.
This'll get called if the source contains the field. I wonder if we should do anything about that? Like, not now, but maybe sometime? I dunno.
|
Pinging @elastic/es-search (:Search/Search) |
|
@romseygeek given all you are doing with mappings, would you like to have a look too and give us some feedback? |
This is the first draft implementation of scripted field of type keyword. Still lots of TODOs to address, this PR targets a feature branch.
Relates to #59332