ODBC Driver for Elasticsearch

Build 23.0.8839

QueryPassthrough

このオプションを使用すると、正確なクエリをElasticsearch に渡すことができます。

データ型

bool

デフォルト値

false

解説

このプロパティをTrue に設定することで、本製品 がElasticsearch クエリを as-is でElasticsearch に渡すことができます。There are two options for submitting as-is queries to Elasticsearch:SQL and Search DSL.

SQL API

Elasticsearch version 6.3 and above supports a SQL API endpoint. When set to true, this option allows you to pass SQL queries directly to the Elasticsearch SQL API. Columns will be identified based on the metadata returned in the response.

Supported SQL syntax and commands can be found in the Elasticsearch documentation.

Note:SQL functionality is limited to what is supported by Elasticsearch.

Search DSL

Alternatively, queries can be submitted using Elasticsearch's Search DSL language, which includes Query DSL. This functionality is available in all versions of Elasticsearch.

サポートされるクエリ構文は次で説明されるクエリパススルー構文を使ったJSON です。

JSON パススルークエリ構文では、以下のエレメントがサポートされます:

エレメント名 関数
index クエリするElasticsearch インデックス(もしくはスキーマ)。これは、文字列値を取るJSON エレメントです。
type index内のクエリするElasticsearch タイプ(もしくはテーブル)。これは、文字列値を取るJSON エレメントです。
docid index.type内のクエリするドキュメントのId。これは、文字列値を取るJSON エレメントです。
apiendpoint クエリするElasticsearch API エンドポイント。デフォルト値は'_search' です。これは、文字列値を取るJSON エレメントです。
requestdata そのままのElasticsearch DSL でElasticsearch にas is で渡されます。値はJSON オブジェクトで直接Elasticsearch により要求される形式にマップされます。

indextypedocid、およびapiendpointrequestdata が送信されるURL を生成するために使われます。 URL は次の形式を使って生成されます: [Server]:[Port]/[index]/[type]/[docid]/[apiendpoint]。JSON パススルーエレメントのどれかが指定されていない場合は、URL には追加されません。

以下に、パススルークエリの例を示します。この例では、megacorp.employeelast_name に'smith' を含むものから初めの10のドキュメントを取得します。結果はfirst_name の降順で並べられます。

{ 
  "index": "megacorp", 
  "type": "employee", 
  "requestdata": 
  {
    "from": 0,
    "size": 10,
    "query": {"bool":{"must":{"term":{"last_name":"smith"}}}},
    "sort": {"first_name":{"order":"desc"}}
  }
}

QueryPassthrough を使う場合、metadata はレスポンスで返されたデータによって決まります。RowScanDepth はmetadata (カラムおよびタイプ)を判断するためにスキャンされるレコードの量を規定します。 Metadata がレスポンスデータに依存するため、パススルークエリは、SQL 構文を使って実行された類似のクエリとは異なる結果を表示することがあります。

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839