# Issue with query on not indexed field

**URL:** <https://discuss.elastic.co/t/issue-with-query-on-not-indexed-field/158363>\
**Category:** Elasticsearch\
**Created:** [November 27, 2018, 2:55pm UTC](https://discuss.elastic.co/t/issue-with-query-on-not-indexed-field/158363 "2018-11-27T14:55:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thomas-11](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@Thomas-11](https://discuss.elastic.co/u/Thomas-11)\
**Post date:** [November 27, 2018, 2:55pm UTC](https://discuss.elastic.co/t/issue-with-query-on-not-indexed-field/158363/1 "2018-11-27T14:55:57Z")

</div>

Hello,

I have a mapping where the field "payload" is not indexed. But I would like to build this kind of query:

{  
"size": 0,  
"query": {  
"bool": {  
"must": [  
{  
"term": {  
"type": "hr-training"  
}  
},  
{  
"match": {  
"steps.payload.period.keyword": "2018-09"  
}  
}  
]  
}  
}  
}

The query returns nothing, but the data exists. What do I wrong?  
Please find below the mapping and a sample of data:

(Issue in bold)

* * *

MAPPING

{  
"mapping": {  
"\_doc": {  
"properties": {  
"creationdate": {  
"type": "date"  
},  
"enddate": {  
"type": "date"  
},  
"flowtitle": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"lastupdate": {  
"type": "date"  
},  
"startdate": {  
"type": "date"  
},  
"status": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"steps": {  
"properties": {  
"\_id": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"comment": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"creationdate": {  
"type": "date"  
},  
"enddate": {  
"type": "date"  
},  
**"payload": {**  
\*\* "type": "object",\*\*  
\*\* "enabled": false\*\*  
\*\* },\*\*  
"result": {  
"type": "object",  
"enabled": false  
},  
"startdate": {  
"type": "date"  
},  
"status": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"title": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
},  
"type": {  
"type": "text",  
"fields": {  
"keyword": {  
"type": "keyword",  
"ignore\_above": 256  
}  
}  
}  
}  
},  
"type": {  
"type": "keyword"  
}  
}  
}  
}  
}

* * *

DATA

"\_index": "xxxxxx-2018.11.27",  
"\_type": "\_doc",  
"\_id": "ouK7VGcBrSwGPSicsgVp",  
"\_score": 0.2876821,  
"\_source": {  
"type": "hr-training",  
"status": "completed",  
"creationdate": "2018-11-27T10:34:06.103Z",  
"lastupdate": "2018-11-27T10:34:25.753Z",  
"flowtitle": "xxx",  
"startdate": "2018-11-27T10:34:06.073Z",  
"steps": [  
{  
"result": {  
"archivePath": "xxxxx"  
},  
"creationdate": "2018-11-27T10:34:06.350Z",  
"enddate": "2018-11-27T10:34:07.012Z",  
**"payload": {**  
\*\* "folderPath": "xxxxx",\*\*  
\*\* "period": "2018-09",\*\*  
\*\* "fileName": "xxxx",\*\*  
\*\* "fileTemplate": "xxxx"\*\*  
\*\* },\*\*  
"comment": "xxxxxx",  
"\_id": "ouK7VGcBrSwGPSicsgVp1543314846350",  
"startdate": "2018-11-27T10:34:06.347Z",  
"type": "hr-training-archive",  
"title": "Archive file",  
"status": "completed"  
},  
{  
"result": {  
"nbRows": 264  
},  
"creationdate": "2018-11-27T10:34:07.058Z",  
"enddate": "2018-11-27T10:34:11.040Z",  
"payload": {  
"folderPath": "xxxxxx",  
"period": "2018-09",  
"fileName": "xxxxx",  
"fileTemplate": "xxxx"  
},  
"comment": "xxxxxxx",  
"\_id": "ouK7VGcBrSwGPSicsgVp1543314847058",  
"startdate": "2018-11-27T10:34:07.055Z",  
"type": "hr-training-parse",  
"title": "xxxxxxx",  
"status": "completed"  
},  
{  
"result": {  
"nbRows": 264  
},  
"creationdate": "2018-11-27T10:34:11.066Z",  
"enddate": "2018-11-27T10:34:23.676Z",  
"payload": {  
"period": "2018-09",  
"fileTemplate": "xxxxx",  
"nbRows": 264  
},  
"comment": "xxxxxxx",  
"\_id": "ouK7VGcBrSwGPSicsgVp1543314851066",  
"startdate": "2018-11-27T10:34:11.064Z",  
"type": "hr-training-store",  
"title": "xxxxxxx",  
"status": "completed"  
}  
],  
"enddate": "2018-11-27T10:34:25.750Z"  
}  
}

Thanks!

---

<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:** [December 25, 2018, 2:56pm UTC](https://discuss.elastic.co/t/issue-with-query-on-not-indexed-field/158363/2 "2018-12-25T14:56:01Z")

</div>

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