# Why the query result of match\_phrase\_prefix and prefix is different

**URL:** <https://discuss.elastic.co/t/why-the-query-result-of-match-phrase-prefix-and-prefix-is-different/142845>\
**Category:** Elasticsearch\
**Created:** [August 3, 2018, 4:56am UTC](https://discuss.elastic.co/t/why-the-query-result-of-match-phrase-prefix-and-prefix-is-different/142845 "2018-08-03T04:56:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhujipeng](https://avatars.discourse-cdn.com/v4/letter/z/45deac/32.png) [@zhujipeng](https://discuss.elastic.co/u/zhujipeng)\
**Post date:** [August 3, 2018, 4:56am UTC](https://discuss.elastic.co/t/why-the-query-result-of-match-phrase-prefix-and-prefix-is-different/142845/1 "2018-08-03T04:56:44Z")

</div>

## wildcard query

```auto
GET information/_validate/query?explain
{
  "query": {
    "bool": {
      "should": [
        {
          "wildcard": {
            "title": "cve-2018*"
          }
        },
        {
          "wildcard": {
            "content": "cve-2018*"
          }
        }
      ]
    }
  }
}

```

the explain result of `wildcard` query

```auto

{
  "valid": true,
  "_shards": {
    "total": 12,
    "successful": 12,
    "failed": 0
  },
  "explanations": [
    {
      "index": "manual_infos",
      "valid": true,
      "explanation": "title:cve-2018* content:cve-2018*"
    },
    {
      "index": "twitter-com",
      "valid": true,
      "explanation": "title:cve-2018* content:cve-2018*"
    }
  ]
}

```

## match\_phrase\_prefix query

```auto
GET information/_validate/query?explain
{
  "query": {
    "bool": {
      "should": [
        {
          "match_phrase_prefix": {
            "title": {
              "query": "cve-2018"
            }
          }
        },
        {
          "match_phrase_prefix": {
            "content": {
              "query": "cve-2018"
            }
          }
        }
      ]
    }
  }
}

```

the explain result of `match_phrase_prefix` query , and the result is a malformed json

```auto
{
  "valid": true,
  "_shards": {
    "total": 12,
    "successful": 12,
    "failed": 0
  },
  "explanations": [
    {
      "index": "manual_infos",
      "valid": true,
      "explanation": """title:"cve-2018*" content:"cve-2018*""""
    },
    {
      "index": "twitter-com",
      "valid": true,
      "explanation": """title:"cve-2018*" content:"cve-2018*""""
    }
  ]
}

```

## version about

- elasticsearch version: 5.6.4
- kibana version: 5.6.4

---

<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:** [August 31, 2018, 4:56am UTC](https://discuss.elastic.co/t/why-the-query-result-of-match-phrase-prefix-and-prefix-is-different/142845/2 "2018-08-31T04:56:54Z")

</div>

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