# Custom analyzer doesn't work in mapping but is fine through index/\_analyze endpoint, ES v6.8.10

**URL:** https://discuss.elastic.co/t/custom-analyzer-doesnt-work-in-mapping-but-is-fine-through-index-analyze-endpoint-es-v6-8-10/280665
**Category:** Elasticsearch
**Created:** [August 6, 2021, 3:35pm UTC](https://discuss.elastic.co/t/custom-analyzer-doesnt-work-in-mapping-but-is-fine-through-index-analyze-endpoint-es-v6-8-10/280665 "2021-08-06T15:35:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tehowe](https://avatars.discourse-cdn.com/v4/letter/t/a3d4f5/32.png) [@tehowe](https://discuss.elastic.co/u/tehowe)
#### Post date: [August 6, 2021, 3:35pm UTC](https://discuss.elastic.co/t/custom-analyzer-doesnt-work-in-mapping-but-is-fine-through-index-analyze-endpoint-es-v6-8-10/280665/1 "2021-08-06T15:35:25Z")

</div>

Why, if I've written an analyzer for Elasticsearch which works when I use the analysis API endpoint, does it not get picked up and used when I set the mapping for a field to that analyzer?

This works:

```auto
GET cobalt_strike/_analyze
{
  "text": [
      "gov.domain.org",
      "mfa.gov.domain.org",
      "justice.gov.domain.org"
    ],
  "analyzer": "domain_name_analyzer"
}

```

This doesn't:

```auto
          "host_domains" : {
            "type" : "text",
            "analyzer" : "domain_name_analyzer"
          },

```

What am I doing wrong? Thanks.

---

<div class="post-metadata">

### Author: ![tehowe](https://avatars.discourse-cdn.com/v4/letter/t/a3d4f5/32.png) [@tehowe](https://discuss.elastic.co/u/tehowe)
#### Post date: [August 9, 2021, 8:49pm UTC](https://discuss.elastic.co/t/custom-analyzer-doesnt-work-in-mapping-but-is-fine-through-index-analyze-endpoint-es-v6-8-10/280665/2 "2021-08-09T20:49:26Z")

</div>

Ok for future reference (and I wish this was more evident from the documentation), analyzer works in searching ONLY it does not modify the document being stored. So you'll never see a change in Kibana showing the stored tokens and you can't see the tokens created directly other than when using the \_analyzer endpoint.

---

<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: [September 6, 2021, 8:50pm UTC](https://discuss.elastic.co/t/custom-analyzer-doesnt-work-in-mapping-but-is-fine-through-index-analyze-endpoint-es-v6-8-10/280665/3 "2021-09-06T20:50:18Z")

</div>

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