# Highlighting fields of stored nested document with \_source disabled

**URL:** <https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901>\
**Category:** Elasticsearch\
**Created:** [February 19, 2014, 4:59pm UTC](https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901 "2014-02-19T16:59:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![angella](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@angella](https://discuss.elastic.co/u/angella)\
**Post date:** [February 19, 2014, 4:59pm UTC](https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901/1 "2014-02-19T16:59:57Z")

</div>

Hi all.  
I'm experiencing problems trying to highlight fields of nested document.  
The parent document has its \_source disabled (enabled : false).  
Nested document and its fields has store option set to yes. And I'm trying  
to query and highlight it with the following request  
{  
"query": {  
"query\_string": {  
"query": "red"  
}  
},  
"highlight": {  
"fields": {  
"Metadata.Category": {}  
}  
}  
}

If \_source is enabled this request works just fine. But if I disable source  
and change mapping to include store option for nested document this doesn't  
work(the document is found but not highlighted).

Here is a part of my mapping  
{  
...  
"\_source" :{"enabled" :false},  
properties: {  
...  
"Name": {  
"type": "multi\_field", store : "yes",  
"fields": {  
"Name": { "type": "string",store : "yes", "analyzer":  
"en\_analyzer" },  
"\_Name": { "type": "string",store : "yes", "index":  
"not\_analyzed" }  
}  
}  
...

```
      Metadata: {
        store :"yes",
        type: "nested",
        properties: {
           ....
            "Text": {
                "type": "multi_field", store :"yes",
                "fields": {
                    "Text": {"type": "string", store :"yes", 

```

"analyzer": "en\_analyzer" },  
"\_Text": { "type": "string",store :"yes", "index":  
"not\_analyzed" }  
}  
},  
"Category": {  
"type": "multi\_field", store :"yes",  
"fields": {  
"Category": {"type": "string", store :"yes" ,  
"analyzer": "en\_analyzer" },  
"\_Category": { "type": "string", store :"yes",  
"index": "not\_analyzed" }  
}  
}  
...  
}

```
    }                                                            

```

.....  
}  
};

When I do the same to the field Name that is not in nested document it  
works just fine.

Could anybody please tell me what am I doing wrong, and is it possible to  
highlight stored field of nested document?

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ceac9780-bf60-42d8-9cab-4bcf6dffb393%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ceac9780-bf60-42d8-9cab-4bcf6dffb393%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [March 13, 2014, 7:36am UTC](https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901/2 "2014-03-13T07:36:38Z")

</div>

Hi,

I had similar situation and I created the following issue.

[https://github.com/elasticsearch/elasticsearch/issues/5245](https://github.com/elasticsearch/elasticsearch/issues/5245)

And this issue is already closed.  
Unfortunately, this behavior is the limitation of nested object currently.

I hope this will answer your needs.

Regards,  
Jun

2014-02-20 1:59 GMT+09:00 Angel Cross [niegis19@gmail.com](mailto:niegis19@gmail.com):

> Hi all.  
> I'm experiencing problems trying to highlight fields of nested document.  
> The parent document has its \_source disabled (enabled : false).  
> Nested document and its fields has store option set to yes. And I'm trying  
> to query and highlight it with the following request  
> {  
> "query": {  
> "query\_string": {  
> "query": "red"  
> }  
> },  
> "highlight": {  
> "fields": {  
> "Metadata.Category": {}  
> }  
> }  
> }
> 
> If \_source is enabled this request works just fine. But if I disable  
> source and change mapping to include store option for nested document this  
> doesn't work(the document is found but not highlighted).
> 
> Here is a part of my mapping  
> {  
> ...  
> "\_source" :{"enabled" :false},  
> properties: {  
> ...  
> "Name": {  
> "type": "multi\_field", store : "yes",  
> "fields": {  
> "Name": { "type": "string",store : "yes", "analyzer":  
> "en\_analyzer" },  
> "\_Name": { "type": "string",store : "yes", "index":  
> "not\_analyzed" }  
> }  
> }  
> ...
> 
> ```
> Metadata: {
> store :"yes",
> type: "nested",
> properties: {
> ....
> "Text": {
> "type": "multi_field", store :"yes",
> "fields": {
> "Text": {"type": "string", store :"yes",
> 
> ```
> 
> "analyzer": "en\_analyzer" },  
> "\_Text": { "type": "string",store :"yes",  
> "index": "not\_analyzed" }  
> }  
> },  
> "Category": {  
> "type": "multi\_field", store :"yes",  
> "fields": {  
> "Category": {"type": "string", store :"yes" ,  
> "analyzer": "en\_analyzer" },  
> "\_Category": { "type": "string", store :"yes",  
> "index": "not\_analyzed" }  
> }  
> }  
> ...  
> }
> 
> ```
> }
> 
> ```
> 
> .....  
> }  
> };
> 
> When I do the same to the field Name that is not in nested document it  
> works just fine.
> 
> Could anybody please tell me what am I doing wrong, and is it possible to  
> highlight stored field of nested document?
> 
> Thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ceac9780-bf60-42d8-9cab-4bcf6dffb393%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ceac9780-bf60-42d8-9cab-4bcf6dffb393%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

## --

Jun Ohtani  
blog : [http://blog.johtani.info](http://blog.johtani.info)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPW8A5zG00RwzTj6nQVopTybynrNNYsORPfFgq\_DyNrtE6dmGw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPW8A5zG00RwzTj6nQVopTybynrNNYsORPfFgq_DyNrtE6dmGw%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![angella](https://avatars.discourse-cdn.com/v4/letter/a/6f9a4e/32.png) [@angella](https://discuss.elastic.co/u/angella)\
**Post date:** [March 13, 2014, 10:28am UTC](https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901/3 "2014-03-13T10:28:13Z")

</div>

_Jun Ohtani_  
Thanks. This helped. Now my conscience is clear =)

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/75f65fcf-3c82-4e62-9476-11c20127765e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/75f65fcf-3c82-4e62-9476-11c20127765e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:** [July 6, 2017, 1:43am UTC](https://discuss.elastic.co/t/highlighting-fields-of-stored-nested-document-with--source-disabled/15901/4 "2017-07-06T01:43:31Z")

</div>


