Hello. I have different types of fields in my index type:
{
"test_index": {
"mappings": {
"search_type": {
"properties": {
"keywords": {
"type": "keyword"
},
"person": {
"properties": {
"relation": {
"properties": {
"subject": {
"type": "nested",
"properties": {
"first": {
"type": "keyword"
}
},
"last": {
"type": "keyword"
}
}
}
}
}
}
}
},
"relation": {
"properties": {
"first": {
"type": "keyword"
}
},
"last": {
"type": "keyword"
}
}
}
}
}
}
}
}
}
}
I want to remove fields and I am using reindex, it works fine with simple field like 'keywords':
ReindexAction.INSTANCE.newRequestBuilder( m_transportClient )
.source( "test_index" )
.destination( "test_index_new" )
.script( new Script( "if (ctx._type=="search_type") { ctx._source.remove("keywords") }" ) ).get();
But how should I build the script if I want to delete:
- person.relation.subject.last (field from nested)
- person.relation.subject (nested field)
- relation.first (field from composite field)
- relation (composite field with it's children)