# Wildcard search

**URL:** <https://discuss.elastic.co/t/wildcard-search/276848>\
**Category:** Elasticsearch\
**Created:** [June 23, 2021, 9:08pm UTC](https://discuss.elastic.co/t/wildcard-search/276848 "2021-06-23T21:08:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Shinde](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@Abhishek\_Shinde](https://discuss.elastic.co/u/Abhishek_Shinde)\
**Post date:** [June 23, 2021, 9:08pm UTC](https://discuss.elastic.co/t/wildcard-search/276848/1 "2021-06-23T21:08:10Z")

</div>

I’m trying to achieve searches with wildcard characters but no luck with match and intervals query,

1. Alice \* \* \* Bob: find all the documents that have a 5-word phrase starting with “Alice” followed by 3 words and then “Bob”.

2. Alice \* \* Bob \* Sam: find all the documents that have a 6-word phrase starting with “Alice” followed by 2 words followed by “Bob” followed by one word and then “Sam”.

3. Alice? \* \* Bob: find all the documents that have a 4-word phrase starting with “Alice?”(? can be any character) followed by 2 words followed by “Bob".

I’ve tried following in the Elasticsearch:

> **[Match phrase query | Elasticsearch Guide \[7.13\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query-phrase.html)**

> **[Intervals query | Elasticsearch Guide \[7.13\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/query-dsl-intervals-query.html)**

Match phrase query did not work as the slop parameter was focusing on max distance and not exact distance.

Any guidance would be helpful here.

---

<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:** [July 21, 2021, 9:08pm UTC](https://discuss.elastic.co/t/wildcard-search/276848/2 "2021-07-21T21:08:12Z")

</div>

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