I am working in ES 1.5.2. I have an index with documents, with stored timestamp values. I want to add a regular field to it, which will assume the value of the _timestamp field
In ES 1.5.2, you can use the update by query plugin in order to reindex your documents and copy the _timestamp
field to a regular field.
After installing the plugin with the following command:
bin/plugin -url http://oss.sonatype.org/content/repositories/releases/com/yakaz/elasticsearch/plugins/elasticsearch-action-updatebyquery/1.0.0/elasticsearch-action-updatebyquery-1.0.0.zip install elasticsearch-action-updatebyquery
And making sure that dynamic scripting is enabled in your elasticsearch.yml
configuration file, you'll be able to run the following command
POST /twitter/_update_by_query
{
"script": {
"inline": "ctx._source.new_timestamp = ctx._timestamp”
},
"query": {
"match_all": {}
}
}