{"id":21994508,"url":"https://github.com/codelibs/elasticsearch-sstmpl","last_synced_at":"2025-04-30T17:02:33.583Z","repository":{"id":21669593,"uuid":"24990594","full_name":"codelibs/elasticsearch-sstmpl","owner":"codelibs","description":"Script-based Search Template for Elasticsearch","archived":false,"fork":false,"pushed_at":"2023-06-14T22:29:09.000Z","size":143,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-30T18:04:42.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codelibs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-09T13:36:02.000Z","updated_at":"2022-02-14T04:02:47.000Z","dependencies_parsed_at":"2022-08-17T16:11:12.247Z","dependency_job_id":null,"html_url":"https://github.com/codelibs/elasticsearch-sstmpl","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Felasticsearch-sstmpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Felasticsearch-sstmpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Felasticsearch-sstmpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codelibs%2Felasticsearch-sstmpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codelibs","download_url":"https://codeload.github.com/codelibs/elasticsearch-sstmpl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251748929,"owners_count":21637413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-29T21:09:32.646Z","updated_at":"2025-04-30T17:02:33.532Z","avatar_url":"https://github.com/codelibs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Elasticsearch Script-based Search Template Plugin\n=======================\n\n## Overview\n\nThis plugin provides Script-based Search Template.\nElasticsearch has [Search Template](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-template.html \"Search Template\") which is Mustache-based template.\nSince Mustache is Logic-less templates, you cannot put any logic, such as if-statement, into a search template.\nThis plugin executes a script-based search template to create a search query.\nTherefore, you can use any script you want in Search Template.\n\n## Version\n\n[Versions in Maven Repository](https://repo1.maven.org/maven2/org/codelibs/elasticsearch-sstmpl/)\n\n### Issues/Questions\n\nPlease file an [issue](https://github.com/codelibs/elasticsearch-sstmpl/issues \"issue\").\n\n## Installation\n\n    $ $ES_HOME/bin/elasticsearch-plugin install org.codelibs:elasticsearch-sstmpl:7.16.3\n\n## References\n\nUsages are similar to Elasticsearch's Search Template.\nIn this plugin, to use Script-based Search Template, \"lang\" property is added.\n\nFor examples in this page, groovy is used as a script language.\nIf you want to use other language, please add a script feature(plugin) to your Elasticsearch.\nWe also provides [Handlebars Lang Plugin](https://github.com/codelibs/elasticsearch-lang-handlebars \"Handlebars Lang Plugin\").\n\n### Filling in a query string with a single value\n\n    GET /_search/script_template\n    {\n        \"lang\": \"mustache\",\n        \"inline\": {\"query\":{\"match\":{\"{{my_field}}\":\"{{my_value}}\"}},\"size\":\"{{my_size}}\"},\n        \"params\": {\n            \"my_field\": \"category\",\n            \"my_value\": \"1\",\n            \"my_size\": \"10\"\n        }\n    }\n\nThe value of template property is executed as a groovy script.\n\n### Index-based pre-registered template\n\nThis plugin is able to call scripts in .script index to create a template.\nTo add a search template as a script,\n\n    POST /_script/search_query_1\n    {\n        \"script\": {\n\t    \"lang\": \"mustache\",\n            \"source\": {\"query\":{\"match\":{\"{{my_field}}\":\"{{my_value}}\"}},\"size\":\"{{my_size}}\"}\n\t}\n    }\n\nand then the search request is:\n\n    GET /_search/script_template\n    {\n        \"id\": \"search_query_1\",\n        \"params\": {\n            \"my_field\": \"category\",\n            \"my_value\": \"1\",\n            \"my_size\": \"10\"\n        }\n    }\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Felasticsearch-sstmpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodelibs%2Felasticsearch-sstmpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodelibs%2Felasticsearch-sstmpl/lists"}