# Completion of particular terms with proximity matching \[5.6\]

**URL:** <https://discuss.elastic.co/t/completion-of-particular-terms-with-proximity-matching-5-6/167890>\
**Category:** Elasticsearch\
**Created:** [February 11, 2019, 3:46pm UTC](https://discuss.elastic.co/t/completion-of-particular-terms-with-proximity-matching-5-6/167890 "2019-02-11T15:46:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shirogami](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Shirogami](https://discuss.elastic.co/u/Shirogami)\
**Post date:** [February 11, 2019, 3:46pm UTC](https://discuss.elastic.co/t/completion-of-particular-terms-with-proximity-matching-5-6/167890/1 "2019-02-11T15:46:42Z")

</div>

Hi,

I would like to be able to query for `quick b* f*` in an index containing : `quick brown fox`, `q brown fox`, `q brown asd eoigj dfg fox`. This query must just return `quick brown fox`. Additionally, a search for `q brown fox` should only match `q brown fox`

I have tried using an edge n-gram analyzer at index time, with a query such as:

```
{
 "query_string": {
    "quote_field_suffix": ".exact",
    "query": "\"q\" b",
    "default_operator": "AND"
  }
}

```

In the example I've given above, I've also provided the documents with an `exact` field at index time, as in the example given on [this page](https://www.elastic.co/guide/en/elasticsearch/reference/5.6/recipes.html#mixing-exact-search-with-stemming), which enables us to exclude `quick brown fox` from the query results. I also specified the `search_analyzer` to be `standard` upon creating the index.

Unfortunately, this solution will still include `q brown asd eoigj dfg fox`. Does anybody know how I could also enforce that `\"q\"` and `b*` should be adjacent when I'm using `quote_field_suffix` in a `query_string` query?

---

<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:** [March 11, 2019, 3:49pm UTC](https://discuss.elastic.co/t/completion-of-particular-terms-with-proximity-matching-5-6/167890/2 "2019-03-11T15:49:22Z")

</div>

Closed on March 11, 2019, 3:49pm UTC

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