# Force\_true parameter in highlight clause does not retrieve the fields properly

**URL:** <https://discuss.elastic.co/t/force-true-parameter-in-highlight-clause-does-not-retrieve-the-fields-properly/78710>\
**Category:** Elasticsearch\
**Created:** [March 15, 2017, 1:51pm UTC](https://discuss.elastic.co/t/force-true-parameter-in-highlight-clause-does-not-retrieve-the-fields-properly/78710 "2017-03-15T13:51:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![guilherme\_maranhao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guilherme_maranhao/32/101483_2.png) [@guilherme\_maranhao](https://discuss.elastic.co/u/guilherme_maranhao)\
**Post date:** [March 15, 2017, 1:51pm UTC](https://discuss.elastic.co/t/force-true-parameter-in-highlight-clause-does-not-retrieve-the-fields-properly/78710/1 "2017-03-15T13:51:05Z")

</div>

Hi everyone,

I set the following \_source and highlight clauses in my search body:

```
{
 "_source":
  [
      "field_1",
      "field_2"
  ],
 "highlight":{
       "order":"score",
       "fragment_size":70,
       "number_of_fragments":3,
       "type":"plain",
       "pre_tags":["\u003cspan class \"highlight\"\u003e"],
       "post_tags":["\u003c/span\u003e"],
       "fields":{
                "field_1":{"force_source":true},
                "field_2":{"force_source":true},
                "field_3":{"force_source":true},
                "field_4":{"force_source":true},
      }
}

```

According to [https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-highlighting.html#\_force\_highlighting\_on\_source](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-highlighting.html#_force_highlighting_on_source), I understood that, setting :force\_source = true in the field highlight, if it occurs a matching on that field, it would be retrieved in the \_source clause.

However, this does not happen with my search. The returned \_source clause was:

```
hits": 
[
     {
			"_index": "index_name",
			"_type": "type_name",
			"_id": "3288191",
			"_score": 1897.5596,
			"_source": {
				"field_1": "201700000030",
				"field_2": {
					"id": 3,
					"desc": "foo"
				}
			},
			"highlight": {
				"field_3": ["something <span class=\"highlight\">search term</span>"],
				"field_4": [": another <span class=\"highlight\">search term</span> <span class=\"highlight\">search term</span>", ": foo bar - <span class=\"highlight\">search term</span>]
			}

```

Did I miss something or the "`force_source`" in this feature has nothing to with the `_source` clause?  
If that's the case, how can I achieve this solution: retrieving a field in the `_source` clause **only** if there is a matching highlight on it?

Thanks,

Guilherme

---

<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:** [April 12, 2017, 1:51pm UTC](https://discuss.elastic.co/t/force-true-parameter-in-highlight-clause-does-not-retrieve-the-fields-properly/78710/2 "2017-04-12T13:51:14Z")

</div>

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