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

Search: Allow to specify script fields to be loaded #221

Closed
kimchy opened this issue Jun 14, 2010 · 1 comment
Closed

Search: Allow to specify script fields to be loaded #221

kimchy opened this issue Jun 14, 2010 · 1 comment

Comments

@kimchy
Copy link
Member

kimchy commented Jun 14, 2010

Script fields are basically scripts that a evaluated and returned per hit, two nice benefits is the fact that the field does not have to be stored, and a custom value can be returned (note, they probably make sense on numeric fields and on not analyzed fields).

A sample:

{
    "query" : {
        ...
    },
    "script_fields" : {
        "test1" : {
            "script" : "doc['my_field_name'].value * 2"
        },
        "test2" : {
            "script" : "doc['my_field_name'].value * factor",
            "params" : {
                "factor"  : 2.0
            }
        }
    }
}
@kimchy
Copy link
Member Author

kimchy commented Jun 14, 2010

Search: Allow to specify script fields to be loaded, closed by 0a1bc87.

ClaudioMFreitas pushed a commit to ClaudioMFreitas/elasticsearch-1 that referenced this issue Nov 12, 2019
Use api_host and api_port + removal of tests
mindw pushed a commit to mindw/elasticsearch that referenced this issue Sep 5, 2022
costin pushed a commit that referenced this issue Dec 6, 2022
Resolves #221

Because ESQL needs to know the context of the current command to correctly parse its structure, command names need to be lexed as individual tokens if they occur in a position where a command name is expected (at the beginning of the query or after a pipe). But if the command name occurs in a different position, it acts as a normal identifier and should be lexed accordingly.

The easiest way to achieve this is to introduce two separate lexer modes. The default mode is used in the command context and the EXPRESSION mode is used when parsing the content of a command (expressions). Another lexer mode in the context of the from command could also be used to address #219.

Unfortunately, lexer modes are only supported if the parser and lexer are split into two separate grammars (not within a combined grammar). I tried to keep the diff caused by this split as minimal as possible but ANTLR does not make this very easy.

Alternatively, one could also allow the command tokens as an alternative for UNQUOTED_IDENTIFIER and then turn it into its string representation in the visitor. This approach is more brittle though as forgetting to add a command as a possible identifier can break existing queries. Additionally, it does not allow alternative lexer modes for commands that accepts arguments other than normal expressions.
cbuescher pushed a commit to cbuescher/elasticsearch that referenced this issue Oct 2, 2023
With this commit we fix retrieval of race meta-data at the end of a
nightly run and we also add a unit test.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant