json - Elasticsearch search templates -
json - Elasticsearch search templates -
i tried using es's search template conditional clause specified here. i'm sending request /[my_index]/_search/template endpoint. request fails because of json parsing issues, makes sense because after adding conditional clause payload no longer valid json. how supposed utilize search templates? there designated endpoint non-json templates?
you need escape template in wrapping string.
from same link referenced:
as written above, template not valid json because includes section markers {{#line_no}}. reason, template should either stored in file (see section called “pre-registered templateedit”) or, when used via rest api, should written string:
"template": "{\"query\":{\"filtered\":{\"query\":{\"match\":{\"line\":\"{{text}}\"}},\"filter\":{{{#line_no}}\"range\":{\"line_no\":{{{#start}}\"gte\":\"{{start}}\"{{#end}},{{/end}}{{/start}}{{#end}}\"lte\":\"{{end}}\"{{/end}}}}{{/line_no}}}}}}"
json templates elasticsearch
Comments
Post a Comment