TomonoriSoejima / Tejun

notes related to working cases
5 stars 3 forks source link

How to use search template #46

Open TomonoriSoejima opened 3 years ago

TomonoriSoejima commented 3 years ago
# tomo2 is my template name in this exercise.

PUT hello/_doc/1
{
  "title": "kore"
}

POST _scripts/tomo2
{
  "script": {
    "lang": "mustache",
    "source": {
      "query": {
        "match": {
          "title": "{{query_string}}"
        }
      }
    }
  }
}

GET _search/template
{
  "id": "tomo2", 
  "params": {
    "query_string": "kore"
  }
}