Hi! Today i add to my document @timestamp field (before this value was not in the document, and document no any date data.) with date data using ingest set processor:
{
"processors": [
{
"set": {
"description": "Add timestamp to document from ingest timestamp as '@timestamp'",
"field": "@timestamp",
"value": "{{{_ingest.timestamp}}}"
}
}
]
}
Then i tried to update_by_query that field.
After that i want to change data value of @timestamp like this:
There were really no effects or the @timestamp field updated to the newer timestamp.
In any case, I suppose the behavior is in line with the specification of elasticsearch. Your settings show "add_timestamp" is stiil working as "default_pipeline". The pipeline works AFTER script field performed and set {{{_ingest.timestamp}}} to @timestamp field finaly.
If you want to delete the field, change the ingest processor.
check that that processor start add @tamstamp to documents
then i made pause for 10-15 minutes
then tried to update @tamstamp by mine value in update_by_query
So you want say that at:
at 6 step that field was changed to my value
at 7 step ingest processor set its own value from _ingest.timestamp?
by that i didn't see any changes?
I understood you right?
Up today i thing that it works only when data added to es, and not when it updated too. Interesting, need to find another solution to set @tamstamp - i need set it only when add document and not when it updated.
Oh, now I know what you have been misunderstainding.
Ingest pipeline also works when documents are updated not only when the document was created. Updating is internaly the same as indexing a new document and delete the old document.
Please see the @timestamp field after updating the document, and compare with the value just before the updating. You will realize the ingest pipeline is also working on updating.
Please see the @timestamp field after updating the document, and compare with the value just before the updating. You will realize the ingest pipeline is also working on updating.
@Tomo_M is correct about the functioning of pipelines.
i need set it only when add document and not when it updated.
One way to do this is attach an if to your set processor in your pipeline.
PUT /_ingest/pipeline/materials_test_pipeline
{
"processors": [
{
"set": {
"description": "Add timestamp to document from ingest timestamp as '@timestamp'",
"field": "@timestamp",
"value": "{{{_ingest.timestamp}}}",
"if": "!ctx.containsKey('@timestamp')"
}
}
]
}
"if": "!ctx.containsKey('@timestamp')" will only set the timestamp if the document does not already have a @timestamp field.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.