Hello guys!
I've been trying to ingest documents through the ingestion pipeline provided by elastic. The idea is quite simple, transform the original JSON into one that has well formatted field names that at some point will make my search queries look clean and pretty.
My original object is this one:
{
"TXM_Envelope": {
"TXM_Header": "my_header"
}
}
after the transformation, I would like to see something like this:
{
"envelope":{
"header":"my_header"
}
}
Which is something that I have accomplished by adding this Rename processor to the ingestion pipeline (this is the only processor that I have):
[
{
"rename": {
"field": "TXM_Envelope.TXM_Header",
"target_field": "envelope.header",
"ignore_missing": true
}
}
]
But along with the transformed JSON, an empty object with the original name (TXM_Envelope) has been created and added to my index _source field:
{
"_index":"test-messages",
"_id":"D5bQ4oQBxa54t0YLYWH0",
"_score":1,
"_source":{
"TXM_Envelope":{
},
"envelope":{
"header":"my_header"
}
}
}
The only way that I could remove the original root field was by adding an additional Remove processor to the pipeline:
[
{
"rename":{
"field":"TXM_Envelope.TXM_Header",
"target_field":"envelope.header",
"ignore_missing":true
}
},
{
"remove":{
"field":"TXM_Envelope"
}
}
]
So, I would like to know there's a way to prevent the empty original field to be indexed at all, and if you guys have any idea on why I've been having this behavior.
Obs: These are my index mapping and settings:
{
"settings": {
"index": {
"default_pipeline": "test-messages-pipeline"
}
},
"mappings": {
"properties": {
"envelope": {
"properties": {
"header": {
"type": "keyword"
}
}
}
}
}
}
Thank you all!
Best regards,
Douglas Korgut