Elasticsearch query to capture '#' character

Hi,

That is because "match" query is a Full text query. Both document fields and query sentences are analyzed to tokens. Maybe the analyzer ignored "#-" and not indexed it as a token.

For exact partial match search, use wildcard queries for wildcard fields or use match phrase query with ngram analyzer. This post is related.

If "Error #-" is a prefix, use keyword mapping and prefix query is another option.

If performance is acceptable, use runtime field with your own script to parse the message field is also another option.