# Wildcard search with dash

**URL:** https://discuss.elastic.co/t/wildcard-search-with-dash/210364
**Category:** Elasticsearch
**Created:** [December 3, 2019, 2:05pm UTC](https://discuss.elastic.co/t/wildcard-search-with-dash/210364 "2019-12-03T14:05:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![111220](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/111220/32/58703_2.png) [@111220](https://discuss.elastic.co/u/111220)
#### Post date: [December 3, 2019, 2:05pm UTC](https://discuss.elastic.co/t/wildcard-search-with-dash/210364/1 "2019-12-03T14:05:09Z")

</div>

I'm trying to write a query to find all data that contains a specific string with dash, for example:  
"abcd-ehd".  
however, using wildcard _abcd-ehd_ doesnt work because the dash is not translated.  
if the data for example is elastic.ebcd-ehd.search, how can i extract it by using wildcard?  
(I have tried using a single (\*) before and after the strring.)

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [December 3, 2019, 2:23pm UTC](https://discuss.elastic.co/t/wildcard-search-with-dash/210364/2 "2019-12-03T14:23:05Z")

</div>

Welcome!

It mostly depends on your mapping and the analyzer you are using for this field.

BTW In general try to avoid wildcards as this could be very slow.

---

<div class="post-metadata">

### Author: ![htsr](https://avatars.discourse-cdn.com/v4/letter/h/bbce88/32.png) [@htsr](https://discuss.elastic.co/u/htsr)
#### Post date: [December 3, 2019, 3:48pm UTC](https://discuss.elastic.co/t/wildcard-search-with-dash/210364/3 "2019-12-03T15:48:53Z")

</div>

Knowing the structure of the strings you search for may be you should try to replace the dash with some _searchable_ character. This could be done with a script while indexing the data. A special mapping which takes this transformation in consideration would also be necessary.

---

<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: [December 31, 2019, 3:48pm UTC](https://discuss.elastic.co/t/wildcard-search-with-dash/210364/4 "2019-12-31T15:48:54Z")

</div>

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