ODBC Driver for Elasticsearch

Build 24.0.9060

ORDER BY Functions

MAPFIELD(column, data_type)

Used to explicitly specify a mapping (by sending the 'unmapped_type' sort option) for a column that does not have a mapping associated with it, which will enable sorting on the column. By default, if a column does not have a mapping, an exception will be thrown containing an error message similar to: "No mapping found for [column] in order to sort on".

Example SQL Query:

SELECT * FROM employee ORDER BY MAPFIELD(start_date, 'long') DESC 
Elasticsearch Sort:
{"start_date":{"order":"desc", "unmapped_type": "long"}}

  • column: The column to perform the order by on.
  • data_type: The Elasticsearch data type to map the column to.

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