# Highlight does not work when \`store\` is set to false and search value does not match normalized filter

**URL:** https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720
**Category:** Elasticsearch
**Created:** [April 26, 2018, 4:07pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720 "2018-04-26T16:07:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![naoko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/naoko/32/11822_2.png) [@naoko](https://discuss.elastic.co/u/naoko)
#### Post date: [April 26, 2018, 4:07pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/1 "2018-04-26T16:07:05Z")

</div>

ES version: 5.5.2

I've created index like this:

```
{
	"settings": {
		"index": {
		"analysis": {
			"normalizer": {
				"normalizer_lower": {
					"type": "custom",
					"filter": ["lowercase"]
				},
				"normalizer_upper": {
					"type": "custom",
					"filter": ["uppercase"]
				}
			}
		}}
	},
	"mappings": {
		"t": {
			"properties": {
				"kw_upper": {
					"type": "keyword",
					"normalizer": "normalizer_upper",
					"ignore_above": 256,
					"store": false
				},
				"kw_lower": {
					"type": "keyword",
					"normalizer": "normalizer_lower",
					"ignore_above": 256,
					"store": false
				},"kw_lower_store": {
					"type": "keyword",
					"normalizer": "normalizer_lower",
					"ignore_above": 256,
					"store": true
				}
			}
		}
	}
}

```

and put documents like these:

```
{ "index" : {"_id" : "1", "_type" : "t", "_index" : "test"}}
 {"kw_lower": "lower.123", "kw_upper": "lower.123", "kw_lower_store": "lower.123"}
{ "index" : {"_id" : "2", "_type" : "t", "_index" : "test"}}
 {"kw_lower": "UPPER.123", "kw_upper": "UPPER.123", "kw_lower_store": "UPPER.123"}

```

when I search "uppercase" normalized field with uppercased value ("UPPER.123")  
it highlights kw\_upper and kw\_lower\_store field only but not kw\_lower.

when I search "lowercase" normalized field with lowercased value ("lower.123")  
it highlights kw\_lower and kw\_lower\_store field only but not kw\_upper.

Is this by design? If so where may I find that in documentation?

Unless I misunderstand this note in doc. Doc states:

> In order to perform highlighting, the actual content of the field is required. If the field in question is stored (has store set to true in the mapping) it will be used, otherwise, the actual \_source will be loaded and the relevant field will be extracted from it.

the value is stored in \_source so I expect that it works without `store=true`.

---

<div class="post-metadata">

### Author: ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)
#### Post date: [April 26, 2018, 5:07pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/2 "2018-04-26T17:07:46Z")

</div>

Can you share your search query?

---

<div class="post-metadata">

### Author: ![naoko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/naoko/32/11822_2.png) [@naoko](https://discuss.elastic.co/u/naoko)
#### Post date: [April 26, 2018, 5:19pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/3 "2018-04-26T17:19:33Z")

</div>

Yes,

```
{
	"query": {
		"multi_match": {
			"fields": ["kw_upper", "kw_lower", "kw_lower_store"],
			"type": "most_fields",
			"query": "lower.123",
			"operator": "or"
		}
	},
	"highlight": {
		"fields": {
			"*": {}
		}
	}
}
```

---

<div class="post-metadata">

### Author: ![johtani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johtani/32/44956_2.png) [@johtani](https://discuss.elastic.co/u/johtani)
#### Post date: [April 27, 2018, 6:19am UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/4 "2018-04-27T06:19:19Z")

</div>

Thx for sharing.

Maybe that was a bug related [this PR](https://github.com/elastic/elasticsearch/pull/27604).

In 6.2.0, you can get the following response:

```auto
GET hoge_highlight/_search
{
	"query": {
		"multi_match": {
			"fields": ["kw_upper", "kw_lower", "kw_lower_store"],
			"type": "most_fields",
			"query": "upper.123",
			"operator": "or"
		}
	},
	"highlight": {
		"fields": {
			"*": {}
		}
	}
}

```

```auto
{
  "took": 497,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 1,
    "max_score": 0.8630463,
    "hits": [
      {
        "_index": "hoge_highlight",
        "_type": "t",
        "_id": "2",
        "_score": 0.8630463,
        "_source": {
          "kw_lower": "UPPER.123",
          "kw_upper": "UPPER.123",
          "kw_lower_store": "UPPER.123"
        },
        "highlight": {
          "kw_upper": [
            "<em>UPPER.123</em>"
          ],
          "kw_lower": [
            "<em>UPPER.123</em>"
          ],
          "kw_lower_store": [
            "<em>upper.123</em>"
          ]
        }
      }
    ]
  }
}

```

---

<div class="post-metadata">

### Author: ![naoko](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/naoko/32/11822_2.png) [@naoko](https://discuss.elastic.co/u/naoko)
#### Post date: [April 27, 2018, 6:46pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/5 "2018-04-27T18:46:19Z")

</div>

Thank you very much! You nailed it. I confirmed this on ver: 6.2.0. We will upgrade to 6.2.0 to solve the issue.

---

<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: [May 25, 2018, 6:46pm UTC](https://discuss.elastic.co/t/highlight-does-not-work-when-store-is-set-to-false-and-search-value-does-not-match-normalized-filter/129720/6 "2018-05-25T18:46:20Z")

</div>

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