Copy_to not copying data in nested object type


(Amit Sharma) #1

copy_to is not storing data as nested object although jobActivity is defined as nested type. If we directly aggregate on jobActivity.jobTitle field. it returns the data but nested aggregation query doesn't return any result.

I am using below query to query nested object

POST /{index_name}/{type}/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggregations" : {
"jobActivity" : {
"nested": {
"path": "jobActivity"
},
"aggregations":{
"jobTitle":{
"terms" : {
"field" : "jobActivity.jobTitle.jobTitle_sort",
"size" :0,
"order" : {
"_term" : "asc"
}
}
}
}
}
}
}

Please find below index mapper for the field:

"appliedJob": {
"type": "nested",
"include_in_parent": true,
"properties": {
"jobTitle": {
"type": "string",
"fields": {
"jobTitle_sort": {
"type": "string",
"index": "not_analyzed"
}
},
"copy_to": [
"jobActivity.jobTitle"
]
}
}
},
"jobActivity": {
"type": "nested",
"properties": {
"jobTitle": {
"type": "string",
"fields": {
"jobTitle_sort": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}


(system) #2

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