# Solr convert having problems with pattern\_replace filter

**URL:** <https://discuss.elastic.co/t/solr-convert-having-problems-with-pattern-replace-filter/162361>\
**Category:** Elasticsearch\
**Created:** [December 28, 2018, 3:38pm UTC](https://discuss.elastic.co/t/solr-convert-having-problems-with-pattern-replace-filter/162361 "2018-12-28T15:38:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robop](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Robop](https://discuss.elastic.co/u/Robop)\
**Post date:** [December 28, 2018, 3:38pm UTC](https://discuss.elastic.co/t/solr-convert-having-problems-with-pattern-replace-filter/162361/1 "2018-12-28T15:38:40Z")

</div>

Hi - I'm trying to convert to using ES having done SOLR for a long time so please bear with me. When I try and put the following I get error message...

"Custom Analyzer [text\_suggest\_analyzer] failed to find filter under name [punctuationfilter]"

Why? I can't see much wrong with my json (but then I don't yet have a trained eye).

Thnks.

```auto
curl -H'Content-Type: application/json' -X PUT http://localhost:9200/my_hw_index -d '
{
  "settings" : {
    "analysis" : {
      "analyzer" : {
        "text_suggest_analyzer" : {
          "type" : "custom",
          "tokenizer" : "basic_tokenizer",
          "filter" : [
            "lowercase",
            "punctuationfilter"
          ]
        }
      },
      "char_filter" : {
        "punctuationfilter" : {
          "type" : "pattern_replace",
          "pattern" : "\\p{Punct}",
          "replacement" : " "
        }
      },
      "tokenizer" : {
        "basic_tokenizer" : {
          "type" : "standard"
        }
      }
    }
  }
}'

```

---

<div class="post-metadata">

**Author:** ![Robop](https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/32.png) [@Robop](https://discuss.elastic.co/u/Robop)\
**Post date:** [December 28, 2018, 3:53pm UTC](https://discuss.elastic.co/t/solr-convert-having-problems-with-pattern-replace-filter/162361/2 "2018-12-28T15:53:34Z")

</div>

Oh look - I managed to answer my own question. It seems that my custom pattern\_replace filter needs to be reference in my custom analyzer in a "char\_filter" section not in a "filter" section. So the following is correct...

```auto
curl -H'Content-Type: application/json' -X PUT http://localhost:9200/autocompleter -d '
{
  "settings" : {
    "analysis" : {
      "analyzer" : {
        "text_suggest_analyzer" : {
          "type" : "custom",
          "tokenizer" : "basic_tokenizer",
          "filter" : [
            "lowercase"
          ],
          "char_filter" : ["punctuationfilter"]
        }
      },
      "char_filter" : {
        "punctuationfilter" : {
          "type" : "pattern_replace",
          "pattern" : "\\p{Punct}",
          "replacement" : " "
        }
      },
      "tokenizer" : {
        "basic_tokenizer" : {
          "type" : "standard"
        }
      }
    }
  }
}'

```

---

<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 25, 2019, 3:53pm UTC](https://discuss.elastic.co/t/solr-convert-having-problems-with-pattern-replace-filter/162361/3 "2019-01-25T15:53:43Z")

</div>

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