# Query\_string to find docs field that start with "abc-"?

**URL:** <https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940>\
**Category:** Kibana\
**Created:** [April 27, 2017, 9:15pm UTC](https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940 "2017-04-27T21:15:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![agonzalez](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@agonzalez](https://discuss.elastic.co/u/agonzalez)\
**Post date:** [April 27, 2017, 9:15pm UTC](https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940/1 "2017-04-27T21:15:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [April 28, 2017, 11:25pm UTC](https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940/2 "2017-04-28T23:25:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![agonzalez](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@agonzalez](https://discuss.elastic.co/u/agonzalez)\
**Post date:** [April 29, 2017, 12:36am UTC](https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940/3 "2017-04-29T00:36:17Z")

</div>

thanks!

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 27, 2017, 12:38am UTC](https://discuss.elastic.co/t/query-string-to-find-docs-field-that-start-with-abc/83940/4 "2017-05-27T00:38:35Z")

</div>

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