Reference

Endpoint Get document by ID from Index or Alias


Name

get_document

Description

No description available

Related Tables

[Dynamic Table] , [Dynamic Table]

Parameters

Parameter Required Options
Name: Id

Label: Enter Document ID

YES
Name: Index

Label: Index

YES
Name: Alias

Label: Alias (Deprecated - Use Index instead)

Output Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
_id DT_WSTR nvarchar(150) 150
_score DT_R8 float
[$parent.Pivot_Path$] DT_WSTR nvarchar(4000) 4000
[$parent.Pivot_Path$].lat DT_R8 float
[$parent.Pivot_Path$].lon DT_R8 float
[$parent.Pivot_Path$].type DT_WSTR nvarchar(30) 30
[$parent.Pivot_Path$].coordinates DT_TEXT varchar(MAX)
If the column you are looking for is missing, consider customizing ElasticSearch Connector.

Input Columns

Label Data Type (SSIS) Data Type (SQL) Length Description
There are no Static columns defined for this endpoint. This endpoint detects columns dynamically at runtime.

Examples

SSIS

Use ElasticSearch Connector in API Source or in API Destination SSIS Data Flow components to read or write data.

API Source

This Endpoint belongs to the [Dynamic Table] table, therefore it is better to use it, instead of accessing the endpoint directly:

API Source - ElasticSearch
Read / write ElasticSearch data inside your app; perform many ElasticSearch operations without coding, just use easy to use high performance API Connector for ElasticSearch
ElasticSearch
[Dynamic Table]
Required Parameters
Enter Document ID Fill-in the parameter...
SSIS API Source - Read from table or endpoint

API Destination

This Endpoint belongs to the [Dynamic Table] table, therefore it is better to use it, instead of accessing the endpoint directly. Use this table and table-operation pair to get document by id from index or alias:

API Destination - ElasticSearch
Read / write ElasticSearch data inside your app; perform many ElasticSearch operations without coding, just use easy to use high performance API Connector for ElasticSearch
ElasticSearch
[Dynamic Table]
Lookup
Required Parameters
Enter Document ID Fill-in the parameter...
SSIS API Destination - Access table operation

ODBC application

Use these SQL queries in your ODBC application data source:

Using JSON Array / Value functions

Below example shows how to select specific elements from value array or use JSON PATH expression to extract from document array

SELECT _id
        , JSON_ARRAY_FIRST(colors) as first_color
        , JSON_ARRAY_LAST(colors) as last_color
        , JSON_ARRAY_NTH(colors,3) as third_color
        , JSON_VALUE(locationList,'$.locationList[0].country') as first_preferred_country
        , JSON_VALUE(locationList,'$.locationList[?(@country=='India')].capital as capital_of_india
FROM shop WHERE _Id='1'

Using JSON Array / Value functions

Below example shows how to select specific elements from value array or use JSON PATH expression to extract from document array

SELECT _id
        , JSON_ARRAY_FIRST(colors) as first_color
        , JSON_ARRAY_LAST(colors) as last_color
        , JSON_ARRAY_NTH(colors,3) as third_color
        , JSON_VALUE(locationList,'$.locationList[0].country') as first_preferred_country
        , JSON_VALUE(locationList,'$.locationList[?(@country=='India')].capital as capital_of_india
FROM shop WHERE _Id='1'

get_document endpoint belongs to [Dynamic Table] , [Dynamic Table] table(s), and can therefore be used via those table(s).

SQL Server

Use these SQL queries in SQL Server after you create a data source in Data Gateway:

Using JSON Array / Value functions

Below example shows how to select specific elements from value array or use JSON PATH expression to extract from document array

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT _id
        , JSON_ARRAY_FIRST(colors) as first_color
        , JSON_ARRAY_LAST(colors) as last_color
        , JSON_ARRAY_NTH(colors,3) as third_color
        , JSON_VALUE(locationList,''$.locationList[0].country'') as first_preferred_country
        , JSON_VALUE(locationList,''$.locationList[?(@country==''India'')].capital as capital_of_india
FROM shop WHERE _Id=''1''';

EXEC (@MyQuery) AT [LS_TO_ELASTICSEARCH_IN_GATEWAY];

Using JSON Array / Value functions

Below example shows how to select specific elements from value array or use JSON PATH expression to extract from document array

DECLARE @MyQuery NVARCHAR(MAX) = 'SELECT _id
        , JSON_ARRAY_FIRST(colors) as first_color
        , JSON_ARRAY_LAST(colors) as last_color
        , JSON_ARRAY_NTH(colors,3) as third_color
        , JSON_VALUE(locationList,''$.locationList[0].country'') as first_preferred_country
        , JSON_VALUE(locationList,''$.locationList[?(@country==''India'')].capital as capital_of_india
FROM shop WHERE _Id=''1''';

EXEC (@MyQuery) AT [LS_TO_ELASTICSEARCH_IN_GATEWAY];

get_document endpoint belongs to [Dynamic Table] , [Dynamic Table] table(s), and can therefore be used via those table(s).