We’re passing user input into a multi_match with minimal escaping. If the user searches ”something
(unbalanced quotes), ES responds with a 400:
{
root_cause: [
{
type: 'token_mgr_error',
reason: 'token_mgr_error: Lexical error at line 1, column 10. Encountered: <EOF> after prefix "\\"something" (in lexical state 2)'
}
],
type: 'search_phase_execution_exception',
reason: 'all shards failed',
phase: 'query',
grouped: true,
failed_shards: [ ... ],
caused_by: {
type: 'token_mgr_error',
reason: 'token_mgr_error: Lexical error at line 1, column 10. Encountered: <EOF> after prefix "\\"something" (in lexical state 2)'
}
I can’t find documentation on exceptions. Can I reliably assume search_phase_execution_exception
indicates user input error or should I check for token_mgr_error
- or something else? I’d like to distinguish user-input issues from deeper issues.
Thanks!