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

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