Scripting using lang-python

We have implemented a custom_score_query that needs a more robust
scoring algorithm that calculates score differently based on
doc["_type"]. For these calculations, we need the current date/time.
We would like to implement a preloaded script in python but have been
unable to find any samples. Could you point us to some examples?

Additionally, we want to better understand the capabilities of the
lang-python plugin? Can we import python modules? Can we get the
current date/time within the script?

We appreciate your assistance.

On Wed, Jan 4, 2012 at 6:46 PM, awopython aoliver865@gmail.com wrote:

We have implemented a custom_score_query that needs a more robust
scoring algorithm that calculates score differently based on
doc["_type"]. For these calculations, we need the current date/time.
We would like to implement a preloaded script in python but have been
unable to find any samples. Could you point us to some examples?

You can pass the timestamp as a parameter to the script, or get the current
timestamp using python (I am not familiar enough with python to tell you
how to do it).

Additionally, we want to better understand the capabilities of the
lang-python plugin? Can we import python modules? Can we get the
current date/time within the script?

The support for python uses jython, so whatever you can do there...

We appreciate your assistance.