I'm trying to figure out if it's possible to update only some fields of a document with dataframe transforms similar to the way the index document update API works (https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html).
I have used an existing transform to create the destination documents and I want to add some fields to the same documents. Is there an option for that? From my attempts it seems that new transforms overwrite the old document.
yes, that's correct. There is no way to update a document, transform always overwrites.
Can you explain your usecase in more detail, best with an example: what's the input, what's the expected output? Maybe there is another way to achieve your end goal. It sounds to me like you try to join documents from different indexes?
thank you for your reply. Yes, you are correct the end result is kinda like trying to join documents from different indices.
So the use case is trying to calculate group aggregates of some customers' past purchases and future purchases based on predictions of a ML model. What I would like is to have the aggregates of their past month purchases, aggregated again in customer groups (based on the amount they spent and the days they have been shopping for) and also calculate the aggregate of this customers' group model predicted purchases (which are stored in a different index).
a transform can have multiple sources and they do not need a common schema as long as the field name of the group_by is compatible. So if you have for example a field "customer_id" in both indices "past_purchases" and "predicted_purchases" you can create a transform that joins over both indices:
Note that aggregations are robust w.r.t. to missing fields, so if you have a field in your "past_purchases" index, but not in "predicted_purchases" you can still aggregate on it to e.g. calculate an average (with the correct count under the hood).
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.