API syntax - Text Analysis with Amazon OpenSearch Service (successor to Amazon Elasticsearch Service) and Amazon Comprehend

API syntax

The Text Analysis with Amazon OpenSearch Service and Amazon Comprehend solution creates the following API to configure the preprocessing.

Preprocessing configuration API

Create and update preprocessing configurations API

Create and update preprocessing configurations for built-in document preprocessing logic using Amazon Comprehend operations.

Create Request Syntax

PUT /preprocessing_configurations { "comprehendConfigurations": [ { "indexName": "string", "fieldName": "string", "comprehendOperations": [ "string" ], "languageCode": "string" }, … ] }

Update Request Syntax

PUT /preprocessing_configurations/_update { "comprehendConfigurations": [ { "indexName": "string", "fieldName": "string", "comprehendOperations": [ "string" ], "languageCode": "string" }, … ] }
Objects Types Required Description
indexName String Yes The name of the index
fieldName String Yes

This syntax indicates which value in a JSON document needs to be preprocessed by Amazon Comprehend.

Note

If multiple Amazon Comprehend configuration objects are present in the request, the fieldName for each Amazon Comprehend configuration object must be unique.

comprehendOperations List of Strings Yes List of supported Amazon Comprehend operations. Allowed values are DetectDominantLanguage, DetectSentiment, DetectKeyPhrases, DetectEntities, DetectSyntax.
languageCode String Yes The language of the corresponding field’s value in the JSON document. Allowed values are en, es, fr, de, it, pt.

Response syntax

The example response syntax is as follows:

{ "_index": ".comprehend", "_type": "config", "_id": "0", "_version": 5, "result": "updated", "_shards": { "total": 2, "successful": 2, "failed": 0 }, "_seq_no": 4, "_primary_term": 1 }

Get preprocessing_configurations API

Request syntax

GET /preprocessing_configurations

Response syntax

The API response should mimic the following example:

{ "_index": “. comprehend", "_type": "config", "_id": "0", "_version": 3, "_seq_no": 2, "_primary_term": 1, "found": true, "_source": { "comprehendConfigurations": [ { "fieldName": "foo", "comprehendOperations": [ "DetectSentiment" ], "languageCode": "es" } ] } }

Delete Configuration API

Request syntax

DELETE /preprocessing_configurations