Hi,

I can not make Search Templates with Sections to work. Anybody has any idea
what I do wrong?

Let's first take a simple example that works (#1) and then I expand it a
bit (#2).

# Example 1 (works fine)

GET _search/template
{
  "template" : {
    "size": "{{size}}",
    "query": {
      "match_all": {}
    }
  },
  "params": {
    "size": 2
  }
}

# Example 2 (fails) - it is the same query as in #1 except it should make
the "size" optional depending on params input.

GET _search/template
{
  "template" : {
    {{#apply_size}}
    "size": "{{size}}",
    {{/apply_size}}
    "query": {
      "match_all": {}
    }
  },
  "params": {
    "size": 2,
    "apply_size": false
  }
}

Yields:
ElasticsearchParseException[Failed to parse template]; nested:
JsonParseException[Unexpected character ('{' (code 123)): was expecting
either valid name character (for unquoted name) or double-quote (for
quoted) to start field name\n at [Source: [B@7384e1ef; line: 3, column:
6]]; }]","status":400

Tested with ES:

{"number" : "1.3.0", "build_hash" :
"1265b1454eee7725a6918f57415c480028700fb4", "build_timestamp" :
"2014-07-23T13:46:36Z", "build_snapshot" : false, "lucene_version" : "4.9"}

Regards,
Lukas

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CAO9cvUYFzq-4HCy%3DUn%3DaY_jQ%2BMreQHA939jeX5ynKhehm1Kiqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to