I have an index and I want a field called durationv2. If the field command_details.endTime exists, I want durationv2 to be the difference between command_details.startTime and command_details.endTime. Otherwise, I want it to be the difference between command_details.startTime and now. The goal is for a live viewer to either see how long a command took or how long it is taking. Would something like the following work?
Right now I'm getting a resource_already_exists_exception error on the index. I'm guessing that I'm not using the right syntax to add a new mapping to my index.
Also, it feels like it would be more efficient to calculate the current time once and to pass it as a parameter, but I'm not sure how to do that.
I think I figured it out. First, when adding a mapping, I needed to use the POST verb instead of PUT. Here's what I ended with. I'll need to circle back and account for time zones in the future, but this serves my needs for now.
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.