How can i write search script in Elasticsearch

I must to write a script in groovy that will search in elasticsearch . For example i must to return the documents where the sin(something) = id .

Have you read https://www.elastic.co/guide/en/elasticsearch/reference/2.1/modules-scripting.html?

Yes i read that. But i can't find a good api docs for scripting in elasticsearch .