Running Scripts While Indexing Documents

Is there any way to run groovy scripts while indexing a document in an index. I would like to change the value of a particular time stamp field when individual document is getting indexed. _update API supports scripting through which time stamp can be altered but i would like to do the process during indexing itself.

If you mean that you would like to pre-process documents before they get indexed, this is possible in version 5.x through the ingest node feature. There you can define a pipeline composed of a set of processors, and provide the pipeline id at index time. The pipeline will be executed against the document, and the result will be indexed.

If you are on elasticsearch 1.x or 2.x, the pre-processing should rather be done on the client side, or done through logstash.

Thank you Luca Cavanna. That was helpful. i am in 2.x version. so only way is to pre process the document in client side.