Hi guys,
I've a scenario where I'm storing file contents and path in ES. The file mapping is simple -
File Details = >
Contents
Content hash (this is also an id of the document)
File paths
File path =>
Folder Path
File name
File extension
I add the document first time if the same doesn't exists and update the File paths next time I come across a file with same content.
I'm using script ctx._source.paths += path where I'm passing path as a param. The insert is working fine as part of upsert and from # of deleted document I can see update is also happening. The only problem I've is I see only the last path seen for the file. Previous is getting replaced instead of a new entry getting added to the list.
descriptor = descriptor.Update<T, T>(doc => doc
.IdFrom(item)
.Script("ctx._source.paths = ctx._source.paths + path")
.Params(p => p.Add("path", (item as FileContract).Paths[0])) // This is for testing purpose only. not a production code so using string literals and directly referring first element of array
.Upsert(item));
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.