<commit_before>## Create or update a search template based on a query pattern

Use this API to create or update a search template based on a query pattern.

**Requirement:** OpenSearchServer v1.5

### Call parameters

**URL:** ```/services/rest/index/{index_name}/search/pattern/{template_name}```

**Method:** ```PUT```

**Header**:
- _**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 search pattern query either in JSON or XML format.

    {
            "start": 0,
            "rows": 10,
            "lang": "ENGLISH",
            "operator": "AND",
            "collapsing": {
                "max": 0,
                "mode": "OFF",
                "type": "OPTIMIZED"
            },
            "returnedFields": [
                "url",
                "backlinkCount"
            ],
            "snippets": [
                {
                    "field": "title",
                    "tag": "b",
                    "separator": "...",
                    "maxSize": 200,
                    "maxNumber": 1,
                    "fragmenter": "NO"
                },
                {<commit_msg>Update template_create_update.md<commit_after>## Create or update a search template based on a query pattern

Use this API to create or update a search template based on a query pattern.

**Requirement:** OpenSearchServer v1.5

### Call parameters

**URL:** ```/services/rest/index/{index_name}/search/pattern/{template_name}```

**Method:** ```PUT```

**Header**:
- _**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 search pattern query in either JSON or XML format.

    {
            "start": 0,
            "rows": 10,
            "lang": "ENGLISH",
            "operator": "AND",
            "collapsing": {
                "max": 0,
                "mode": "OFF",
                "type": "OPTIMIZED"
            },
            "returnedFields": [
                "url",
                "backlinkCount"
            ],
            "snippets": [
                {
                    "field": "title",
                    "tag": "b",
                    "separator": "...",
                    "maxSize": 200,
                    "maxNumber": 1,
                    "fragmenter": "NO"
                },
                {
{'fraction_non_alphanumeric': 0.15823935976718806, 'fraction_numerical': 0.007275372862859221, 'mean_word_length': 1.6724975704567542, 'pattern_counts': {'":': 32, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3637272', 'n_tokens_mistral': 786, 'n_tokens_neox': 725, 'n_words': 215}