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


(Alberto Gonzalez) #1

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-"?


(Tim Sullivan) #2

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


(Alberto Gonzalez) #3

thanks!

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


(system) #4

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