# Match\_phrase is not working with keep\_words\_filter in percolator index

**URL:** <https://discuss.elastic.co/t/match-phrase-is-not-working-with-keep-words-filter-in-percolator-index/263557>\
**Category:** Elasticsearch\
**Created:** [February 8, 2021, 8:27am UTC](https://discuss.elastic.co/t/match-phrase-is-not-working-with-keep-words-filter-in-percolator-index/263557 "2021-02-08T08:27:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dahea\_Moon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dahea_moon/32/50610_2.png) [@Dahea\_Moon](https://discuss.elastic.co/u/Dahea_Moon)\
**Post date:** [February 8, 2021, 8:27am UTC](https://discuss.elastic.co/t/match-phrase-is-not-working-with-keep-words-filter-in-percolator-index/263557/1 "2021-02-08T08:27:55Z")

</div>

Hi, elastic team.

I'm working on percolator index with match\_phrase query and keep\_words\_filter.

I found that match\_phrase query is not working properly with keep\_words\_filter.

I've tried both match\_phrase query and simple\_query\_string with "", but both don't work properly.

Both worked as match query with operator 'or'.

Without keep\_words\_filter, both works properly.

Is there any way to fix it?

Thanks in advance.

MAPPING

```auto
{
  "hana_percolator_keep_words" : {
    "mappings" : {
      "properties" : {
        "frm_nm" : {
          "type" : "keyword"
        },
        "query" : {
          "type" : "percolator"
        },
        "text" : {
          "type" : "text",
          "analyzer" : "platform_eng_standard_analyzer"
        }
      }
    }
  }
}

```

DOC QUERY

```auto
{
  "query": {
    "percolate": {
      "field": "query",
      "document": {
          "frm_nm": "CONTRACT",
          "text": "CONTRACT NO"
      }
    }
  }
}

```

PERCOLATOR QUERY RESULT

```auto
{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 7,
      "relation" : "eq"
    },
    "max_score" : 0.26152915,
    "hits" : [
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "5e6wgHcBtnnJlJS9tZKJ",
        "_score" : 0.26152915,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "CONTRACT NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "I-6wgHcBtnnJlJS9tZOJ",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "계약서(CONTRACT)",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "CONT NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "I-6wgHcBtnnJlJS9tpky",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "p-6wgHcBtnnJlJS9tpyV",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "BOX NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "qu6wgHcBtnnJlJS9t6Nb",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "ROLL NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "6O6wgHcBtnnJlJS9uKkk",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "LOT NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      },
      {
        "_index" : "hana_percolator_keep_words",
        "_type" : "_doc",
        "_id" : "o-6wgHcBtnnJlJS9ubND",
        "_score" : 0.13076457,
        "_source" : {
          "query" : {
            "bool" : {
              "filter" : {
                "terms" : {
                  "frm_nm" : [
                    "CONTRACT",
                    "None"
                  ]
                }
              },
              "must" : [
                {
                  "match_phrase" : {
                    "text" : "P.O NO"
                  }
                }
              ]
            }
          }
        },
        "fields" : {
          "_percolator_document_slot" : [
            0
          ]
        }
      }
    ]
  }
}

```

---

<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 8, 2021, 8:28am UTC](https://discuss.elastic.co/t/match-phrase-is-not-working-with-keep-words-filter-in-percolator-index/263557/2 "2021-03-08T08:28:35Z")

</div>

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