# Prefix query with multiple terms in sequence

**URL:** <https://discuss.elastic.co/t/prefix-query-with-multiple-terms-in-sequence/297175>\
**Category:** Elasticsearch\
**Created:** [February 14, 2022, 5:44pm UTC](https://discuss.elastic.co/t/prefix-query-with-multiple-terms-in-sequence/297175 "2022-02-14T17:44:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FelipeGXavier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felipegxavier/32/101806_2.png) [@FelipeGXavier](https://discuss.elastic.co/u/FelipeGXavier)\
**Post date:** [February 14, 2022, 5:44pm UTC](https://discuss.elastic.co/t/prefix-query-with-multiple-terms-in-sequence/297175/1 "2022-02-14T17:44:04Z")

</div>

I'm looking for a way to make a query with multiple terms with prefix that preserve the order they're showed.

Using **match\_phrase\_prefix** only the last term is the prefix.

I can combine **prefix** with multiple **match\_phrase** but then the order is not guarantee.

What i'm looking for is like, searching for "f bar baz" the first term is the prefix and the others must be in order, so the result would be "fo bar baz" and "foo bar baz"

I don't know if Completion Suggester would fit this behaviour well.

---

<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 14, 2022, 5:44pm UTC](https://discuss.elastic.co/t/prefix-query-with-multiple-terms-in-sequence/297175/2 "2022-03-14T17:44:53Z")

</div>

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