HTTP Interface for Analyzers

The RESTful API for managing ArangoSearch Analyzers is accessible via the /_api/analyzer endpoint.

See the description of Analyzers for an introduction and the available types, properties and features.

Analyzer Operations

Create an Analyzer with the supplied definition

creates a new Analyzer based on the provided definition

POST /_api/analyzer

Request Body

  • name (string, required): The Analyzer name.

  • type (string, required): The Analyzer type.

  • properties (object, optional): The properties used to configure the specified Analyzer type.

  • features (array of strings, optional): The set of features to set on the Analyzer generated fields. The default value is an empty array.

Creates a new Analyzer based on the provided configuration.

Responses

HTTP 200: An Analyzer with a matching name and definition already exists.

HTTP 201: A new Analyzer definition was successfully created.

HTTP 400: One or more of the required parameters is missing or one or more of the parameters is not valid.

HTTP 403: The user does not have permission to create and Analyzer with this configuration.

Examples

shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/analyzer <<EOF
{ 
  "name" : "testAnalyzer", 
  "type" : "identity" 
}
EOF

HTTP/1.1 201 Created
content-type: application/json
connection: Keep-Alive
content-length: 80
server: ArangoDB
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Return the Analyzer definition

returns an Analyzer definition

GET /_api/analyzer/{analyzer-name}

Path Parameters

  • analyzer-name (string, required): The name of the Analyzer to retrieve.

Retrieves the full definition for the specified Analyzer name. The resulting object contains the following attributes:

  • name: the Analyzer name
  • type: the Analyzer type
  • properties: the properties used to configure the specified type
  • features: the set of features to set on the Analyzer generated fields

Responses

HTTP 200: The Analyzer definition was retrieved successfully.

HTTP 404: Such an Analyzer configuration does not exist.

Examples

Retrieve an Analyzer definition:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/analyzer/testAnalyzer

HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 105
server: ArangoDB
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

List all Analyzers

returns a listing of available Analyzer definitions

GET /_api/analyzer

Retrieves a an array of all Analyzer definitions. The resulting array contains objects with the following attributes:

  • name: the Analyzer name
  • type: the Analyzer type
  • properties: the properties used to configure the specified type
  • features: the set of features to set on the Analyzer generated fields

Responses

HTTP 200: The Analyzer definitions was retrieved successfully.

Examples

Retrieve all Analyzer definitions:

shell> curl --header 'accept: application/json' --dump - http://localhost:8529/_api/analyzer

HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 2116
server: ArangoDB
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Remove an Analyzer

removes an Analyzer configuration

DELETE /_api/analyzer/{analyzer-name}

Path Parameters

  • analyzer-name (string, required): The name of the Analyzer to remove.

Query Parameters

  • force (boolean, optional): The Analyzer configuration should be removed even if it is in-use. The default value is false.

Removes an Analyzer configuration identified by analyzer-name.

If the Analyzer definition was successfully dropped, an object is returned with the following attributes:

  • error: false
  • name: The name of the removed Analyzer

Responses

HTTP 200: The Analyzer configuration was removed successfully.

HTTP 400: The analyzer-name was not supplied or another request parameter was not valid.

HTTP 403: The user does not have permission to remove this Analyzer configuration.

HTTP 404: Such an Analyzer configuration does not exist.

HTTP 409: The specified Analyzer configuration is still in use and force was omitted or false specified.

Examples

Removing without force:

shell> curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/analyzer/testAnalyzer

HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 57
server: ArangoDB
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body

Removing with force:

shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/collection <<EOF
{ 
  "name" : "testCollection" 
}
EOF

shell> curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/view <<EOF
{ 
  "name" : "testView", 
  "type" : "arangosearch", 
  "links" : { 
    "testCollection" : { 
      "analyzers" : [ 
        "testAnalyzer" 
      ] 
    } 
  } 
}
EOF

shell> curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/analyzer/testAnalyzer?force=false

shell> curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/analyzer/testAnalyzer?force=true

HTTP/1.1 200 OK
content-type: application/json
connection: Keep-Alive
content-length: 57
server: ArangoDB
x-arango-queue-time-seconds: 0.000000
x-content-type-options: nosniff
Show response body