# Behaviour of match\_phrase\_prefix in ES ES 8.9.0 is different from that in 7.17.7

**URL:** https://discuss.elastic.co/t/behaviour-of-match-phrase-prefix-in-es-es-8-9-0-is-different-from-that-in-7-17-7/348283
**Category:** Elasticsearch
**Created:** [November 30, 2023, 2:29am UTC](https://discuss.elastic.co/t/behaviour-of-match-phrase-prefix-in-es-es-8-9-0-is-different-from-that-in-7-17-7/348283 "2023-11-30T02:29:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![elastic-a](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@elastic-a](https://discuss.elastic.co/u/elastic-a)
#### Post date: [November 30, 2023, 2:29am UTC](https://discuss.elastic.co/t/behaviour-of-match-phrase-prefix-in-es-es-8-9-0-is-different-from-that-in-7-17-7/348283/1 "2023-11-30T02:29:40Z")

</div>

ES 8.9.0

With a query having `match_phrase_prefix` of just one term, the search returns expected match; with the same query, percolate by id does not return expected match. The same (both search and percolate) work as expected in ES 7.17.7.

Repro steps:

1. Create a new index with a `str` field of type `text` and a `query` field of type `percolator`
2. Index a doc having `{"str":"the quick brown fox jumps over the lazy dog"}`
3. Perform a \_search `{"query":{"match_phrase_prefix":{"str":{"query":"fox"}}}}` to ensure the doc is searchable (wait until, when not) note \_id
4. Index a query `{"query":{"match_phrase_prefix":{"str":{"query":"fox"}}}}`
5. Percolate by `{"query":{"percolate":{"field":"query","index":"<myindex>","id":"<_id>"}}}`

Note:

- When ES 7.17.7 is used, all steps return expected results.
- When ES 8.9.0 is used, all steps except the final step return expected results.
- When ES 8.9.0 is used, without the match\_phrase\_prefix query or with the query with two-or-more tokens in #4, all steps return expected results.

And, btw, does `match_phrase_prefix` support single token in the query? Or does it expect two-or-more? There is no mentioning of this nor any change in behaviour in the hrefs below..

Help is appreciated.. Thanks..

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

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

---

<div class="post-metadata">

### Author: ![elastic-a](https://avatars.discourse-cdn.com/v4/letter/e/e0b2c6/32.png) [@elastic-a](https://discuss.elastic.co/u/elastic-a)
#### Post date: [December 14, 2023, 10:06pm UTC](https://discuss.elastic.co/t/behaviour-of-match-phrase-prefix-in-es-es-8-9-0-is-different-from-that-in-7-17-7/348283/2 "2023-12-14T22:06:45Z")

</div>

appreciate any insights on this.. thanks..

---

<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: [January 11, 2024, 10:07pm UTC](https://discuss.elastic.co/t/behaviour-of-match-phrase-prefix-in-es-es-8-9-0-is-different-from-that-in-7-17-7/348283/3 "2024-01-11T22:07:39Z")

</div>

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