New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add predefined search templates endpoint #5637
Comments
just an idea, can a template be |
w00t! I love it @s1monw. Because I was not confortable of having this in cluster state! :) I think we will need to cache the template if we don't want to load/compile it on each call. |
… search time This change allows search templates stored in an index to be used at search time. You can run an indexed template by GET /_search/template { 'templatename' : '/index/language/id', 'params' : { 'param1' : 'foo' } } Running the template will fail if the template cannot be found, if the templatename starts with a '/' but does not conform to the /index/type/id triple If the named template cannot be found an error will be raised. Currently the templates are NOT cached. We also use TransportGetAction directly instead of using Client to avoid a circular dependency between Client and ScriptService See elastic#5637
This change allows the creation,update and deletion of indexed templates via the _search/template/{id} endpoint. Storing a template : curl -XPUT 'http://localhost:9200/_search/template/1a' -d ' { "template": { "query": { "match_all": {}}, "size": "{{my_size}}" } }' Deleting a template: curl -XDELETE 'http://localhost:9200/_search/template/1a' Getting a template: curl -XGET 'http://localhost:9200/_search/template/1a' Using an indexed template: curl -XGET 'http://localhost:9200/_search/template' -d ' { "template": { "id" : "1a" }, "params": { "my_size": 100 } }' Or more simply: curl -XGET 'http://localhost:9200/_search/template' -d ' { "id" : "1a", "params": { "my_size": 100 } }' To access on disk templates in template queries the file parameter must now be used. This does break backwards compatiblity with previous versions since the template "query" was previously aliased to dynamic inline templates or on disk templates. See elastic#5637
This rest test indexes a template then uses it in search. See elastic#5637
… search time This change allows search templates stored in an index to be used at search time. You can run an indexed template by GET /_search/template { 'templatename' : '/index/language/id', 'params' : { 'param1' : 'foo' } } Running the template will fail if the template cannot be found, if the templatename starts with a '/' but does not conform to the /index/type/id triple If the named template cannot be found an error will be raised. Currently the templates are NOT cached. We also use TransportGetAction directly instead of using Client to avoid a circular dependency between Client and ScriptService See elastic#5637
This change allows the creation,update and deletion of indexed templates via the _search/template/{id} endpoint. Storing a template : curl -XPUT 'http://localhost:9200/_search/template/1a' -d ' { "template": { "query": { "match_all": {}}, "size": "{{my_size}}" } }' Deleting a template: curl -XDELETE 'http://localhost:9200/_search/template/1a' Getting a template: curl -XGET 'http://localhost:9200/_search/template/1a' Using an indexed template: curl -XGET 'http://localhost:9200/_search/template' -d ' { "template": { "id" : "1a" }, "params": { "my_size": 100 } }' Or more simply: curl -XGET 'http://localhost:9200/_search/template' -d ' { "id" : "1a", "params": { "my_size": 100 } }' To access on disk templates in template queries the file parameter must now be used. This does break backwards compatiblity with previous versions since the template "query" was previously aliased to dynamic inline templates or on disk templates. See elastic#5637
This rest test indexes a template then uses it in search. See elastic#5637
…cripts/template from an index. This change allow elasticsearch users to store scripts and templates in an index for use at search time. Scripts/Templates are stored in the .scripts index. The type of the events is set to the script language. Templates use the mustache language so their type is be "mustache". Adds the concept of a script type to calls to the ScriptService types are INDEXED,INLINE,FILE. If a script type of INDEXED is supplied the script will be attempted to be loaded from the indexed, FILE will look in the file cache and INLINE will treat the supplied script argument as the literal script. REST endpoints are provided to do CRUD operations as is a java client library. All query dsl points have been upgraded to allow passing in of explicit script ids and script file names. Backwards compatible behavior has been preserved so this shouldn't break any existing querys that expect to pass in a filename as the script/template name. The ScriptService will check the disk cache before parsing the script. Closes #5921 #5637 #5484
…cripts/template from an index. This change allow elasticsearch users to store scripts and templates in an index for use at search time. Scripts/Templates are stored in the .scripts index. The type of the events is set to the script language. Templates use the mustache language so their type is be "mustache". Adds the concept of a script type to calls to the ScriptService types are INDEXED,INLINE,FILE. If a script type of INDEXED is supplied the script will be attempted to be loaded from the indexed, FILE will look in the file cache and INLINE will treat the supplied script argument as the literal script. REST endpoints are provided to do CRUD operations as is a java client library. All query dsl points have been upgraded to allow passing in of explicit script ids and script file names. Backwards compatible behavior has been preserved so this shouldn't break any existing querys that expect to pass in a filename as the script/template name. The ScriptService will check the disk cache before parsing the script. Closes #5921 #5637 #5484
Closed by e79b708 |
New feature #5122 allows storing query templates on local nodes.
We should add some endpoints to allow:
Put/Update a search template:
Get a search template:
Remove a search template:
Run the template:
Search for all templates:
The text was updated successfully, but these errors were encountered: