Create or update a _More-Like-This template

Use this API to create or update a search template.

Requirement: OpenSearchServer v1.5.3

Call parameters

URL: /services/rest/index/{index_name}/morelikethis/template/{template_name}

Method: PUT


  • Content-Type (required): application/json
  • Accept (optional returned type): application/json or application/xml

URL parameters:

  • index_name (required): The name of the index.
  • template_name (required): The name of the search template.

Raw data (PUT):
The MoreLikeThis query either in JSON or XML format.

"likeText": "open search server",
"lang": "ENGLISH",
"analyzerName": "StandardAnalyzer",
"fields": [
"minWordLen": 1,
"maxWordLen": 100,
"minDocFreq": 1,
"minTermFreq": 1,
"maxNumTokensParsed": 5000,
"maxQueryTerms": 25,
"boost": true,
"stopWords": "English stop words",
"returnedFields": [
"filters": [
"type": "QueryFilter",
"negative": false,
"query": "lang:en"
"start": 0,
"rows": 10

Success response

The MoreLikeThis template has been created or updated.

HTTP code:

Content (application/json):

"successful": true,
"info": "Template updated: my_mlt"

Error response

The creation/update failed. The reason is provided in the content.

HTTP code:

Sample call

Using CURL:

curl -XPUT -H "Content-Type: application/json" \
-d '...' \

View/edit on GitHub