Query_string to find docs field that start with "abc-"?

I have to documents with field value like

"abc-def"
"def-abc"
"abc"

I want to just search for docs that start with "abc-" but including the - in the search doesnt work and just search for "abc" will not work as it returns the 3 docs.

I have tried "query": "field:abc" and "field:abc-", is there any way to match online ones that start with "abc-"?

Have you tried using a wildcard? For example, field:abc-*. This might work as long as the field type is keyword or not_analyzed.

thanks!

using field.keyword:abc-* is what i wanted

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.