我正在寻找一种方法来存储一个字段的大小(字节)在一个新的领域的文件。
也就是说,当创建一个文档时,其中的字段message
包含值hello
,我希望写入另一个字段message_size_bytes
,在本例中,该字段的值为5
。
我知道使用_update_by_query
和_search
并使用脚本字段的可能性,但是我有太多的数据,我不想在查询时计算大小,而是在索引时。
是否有可能只使用Elasticsearch 7.17来实现这一点?在将数据传递给Elasticsearch之前,我无法访问数据。
1条答案
按热度按时间zd287kbt1#
可以将"摄取管道"与Script processor配合使用。
可使用以下命令创建管线:
创建管道后,您可以在索引数据时使用管道名称,如下所示(您也可以在logstash,java或任何其他客户端中使用):