# \[7.10.2\] Querying for "fields" produces HTML entities despite use of "html\_strip"

**URL:** <https://discuss.elastic.co/t/7-10-2-querying-for-fields-produces-html-entities-despite-use-of-html-strip/280348>\
**Category:** Elasticsearch\
**Created:** [August 3, 2021, 3:56pm UTC](https://discuss.elastic.co/t/7-10-2-querying-for-fields-produces-html-entities-despite-use-of-html-strip/280348 "2021-08-03T15:56:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesjenkins](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@jamesjenkins](https://discuss.elastic.co/u/jamesjenkins)\
**Post date:** [August 3, 2021, 3:56pm UTC](https://discuss.elastic.co/t/7-10-2-querying-for-fields-produces-html-entities-despite-use-of-html-strip/280348/1 "2021-08-03T15:56:10Z")

</div>

We are currently indexing using this analyzer for our text fields:

```auto
lowercase_keyword: {
          type: 'custom',
          char_filter: ['html_strip'],
          tokenizer: 'keyword',
          filter: ['asciifolding', 'lowercase'],
        },

```

Example mapping snippet:

```auto
      lastName: {
        type: 'text',
        analyzer: 'lowercase_keyword',
        fields: {
          raw: {
            type: 'keyword',
          },
        },
      },

```

Using the `/_anaylze` endpoint to check that analyzer composition with a test string (`<p>&quot;The quick brown fox jumps over <strong>the lazy dog.</strong>&quot;</p>`) I can see that the expected decoding is taking place:

```auto
{
	"tokens": [
		{
			"token": "\n\"the quick brown fox jumps over the lazy dog.\"\n",
			"start_offset": 0,
			"end_offset": 80,
			"type": "word",
			"position": 0
		}
	]
}

```

I know that using `_source` will produce the index documents, where I would fully expect to get `D&quot;Angelo` for `lastName` in my index, but when I query using `fields` it was my understanding from reading the documentation that _this_ value would use the mapping and produce the value more inline with what the analyzer example shows.

Hoping to avoid any pre-indexing scrubbing of the data and would appreciate any guidance. Please let me know if I can supplement my examples to help better clarify the problem

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 4, 2021, 9:08am UTC](https://discuss.elastic.co/t/7-10-2-querying-for-fields-produces-html-entities-despite-use-of-html-strip/280348/2 "2021-08-04T09:08:35Z")

</div>

Are you sure that the mapping is properly applied in your index? Can you provide a fully reproducible example including index creation and mapping and document indexing?

Also, there is a processor that strips HTML also in the source, see [HTML strip processor | Elasticsearch Guide [7.13] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/htmlstrip-processor.html)

---

<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 1, 2021, 9:09am UTC](https://discuss.elastic.co/t/7-10-2-querying-for-fields-produces-html-entities-despite-use-of-html-strip/280348/3 "2021-09-01T09:09:07Z")

</div>

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