Navigation

Update All User-Defined Analyzers for a Cluster

The Atlas API uses HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

For complete documentation on configuring API access for an Atlas project, see Configure Atlas API Access.

Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

Base URL: https://cloud.mongodb.com/api/atlas/v1.0

This API request creates new user-defined Full Text Search analyzers and replaces existing ones. If you have any user-defined analyzers for your Full Text Search index, they will be replaced by the new analyzer or analyzers specified in this request.

Syntax

PUT /groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/fts/analyzers

To delete all existing user-defined analyzers from your cluster, send a PUT request to this endpoint with an empty array as the payload.

Warning

Issuing a PUT request to this API endpoint overwrites any existing user-definied Full Text Search analyzers.

Request Parameters

Request Path Parameters

Path Element Required/Optional Description
GROUP-ID Required The unique identifier for the project that contains the specified cluster.
CLUSTER-NAME Required The name of the cluster containing the collection with one or more Full Text Search indexes.

Request Query Parameters

The following query parameters are optional:

Name Type Description Default
pageNum integer Page number (1-based). 1
itemsPerPage integer Number of items to return per page, up to a maximum of 500. 100
pretty boolean Displays response in a prettyprint format. false
envelope boolean Specifies whether or not to wrap the response in an envelope. false

Request Body Parameters

Name Type Required/Optional Description
name string Required The name of the user-defined analyzer.
baseAnalyzer string Required The analyzer on which the user-defined analyzer is based.
maxTokenLength integer Optional Longest text unit to analyze. Anything longer will not be included in the index.
stopwords array of strings Optional Array of strings to ignore when creating the index.
ignoreCase boolean Optional Specify whether the index is case-sensitive.
stemExclusionSet array of strings Optional Array of words to exclude from stemming by the language analyzer.

Response Elements

The HTTP response returns a JSON document that includes an array of analyzer definitions. An analyzer definition contains some or all of the following elements:

Name Type Description
name string The name of the user-defined analyzer.
baseAnalyzer string The analyzer on which the user-defined analyzer is based.
maxTokenLength integer Longest text unit to analyze. Anything longer will not be included in the index.
stopwords array of strings Array of strings to ignore when creating the index.
ignoreCase boolean Specify whether the index is case-sensitive.
stemExclusionSet array of strings Array of words to exclude from stemming by the language analyzer.

Example

Example Request

curl -u "{username}:{apikey}" \
  --digest  \
  --header "Accept: application/json"  \
  --header "Content-Type: application/json"  \
  --request PUT "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/clusters/{CLUSTER-NAME}/fts/analyzers"  \
  --data '[
     {
       "name": "my_new_analyzer",
       "baseAnalyzer": "lucene.standard",
       "maxTokenLength": 48
     },
     {
       "name": "my_other_new_analyzer",
       "baseAnalyzer": "lucene.english",
       "stopwords": [
         "foo",
         "bar",
         "baz"
       ]
     }
   ]'

Example Response

The following example response contains an array of two analyzer definitions.

[
  {
    "name": "my_new_analyzer",
    "baseAnalyzer": "lucene.standard",
    "maxTokenLength": 48
   },
   {
     "name": "my_other_new_analyzer",
     "baseAnalyzer": "lucene.english",
     "stopwords": [
       "foo",
       "bar",
       "baz"
     ]
   }
 ]