Issue with query on not indexed field


#1

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!