All Products
Search
Document Center

DocumentClient

Last Updated: Sep 09, 2021

Overview

This topic describes the DocumentClient class and its methods. This class is used to upload documents.

Class security

Non-thread-safe

Constructor

This constructor requires you to specify an OpenSearchClient object as a parameter.
DocumentClient(OpenSearchClient    client)

Parameter description

Parameter

Type

Description

client

OpenSearchClient

The OpenSearchClient object.


add

Method definition

Adds fields in the Map format.
void    add(Map<String,Object> fields)

Parameter description

Parameter

Type

Description

fields

Map<String,Object>

The fields to be added in the Map format.

Exception description

  • JSONException


update

Method definition

Updates fields in the Map format.
void    update(Map<String,Object> fields)

Parameter description

Parameter

Type

Description

fields

Map<String,Object>

The fields to be updated in the Map format.

Exception description

  • JSONException


remove

Method definition

Deletes fields in the Map format.
void    remove(Map<String,Object> fields)

Parameter description

Parameter

Type

Description

fields

Map<String,Object>

The fields to be deleted in the Map format.

Exception description

  • JSONException


push

Method definition

Uploads data in push mode.
OpenSearchResult    push(String docsJson, String appName, String tableName)

Parameter description

Parameter

Type

Description

docsJson

String

The data to be pushed in the form of a JSON string.

appName

String

The name of the application to which the data is to be pushed.

tableName

String

The table to which the data is to be pushed.

Exception description

  • OpenSearchException

  • OpenSearchClientException


commit

Method definition

Uploads data in commit mode.
OpenSearchResult    commit(String appName,String tableName)

Parameter description

Parameter

Type

Description

appName

String

The name of the application to which the data is to be committed.

tableName

String

The table to which the data is to be committed.

Exception description

  • OpenSearchException

  • OpenSearchClientException