| 1 | # Licensed to Elasticsearch B.V. under one or more contributor | ||
| 2 | # license agreements. See the NOTICE file distributed with | ||
| 3 | # this work for additional information regarding copyright | ||
| 4 | # ownership. Elasticsearch B.V. licenses this file to you under | ||
| 5 | # the Apache License, Version 2.0 (the "License"); you may | ||
| 6 | # not use this file except in compliance with the License. | ||
| 7 | # You may obtain a copy of the License at | ||
| 8 | # | ||
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
| 10 | # | ||
| 11 | # Unless required by applicable law or agreed to in writing, | ||
| 12 | # software distributed under the License is distributed on an | ||
| 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 14 | # KIND, either express or implied. See the License for the | ||
| 15 | # specific language governing permissions and limitations | ||
| 16 | # under the License. | ||
| 17 | |||
| 18 | package Search::Elasticsearch::Client::8_0::Direct::SQL; | ||
| 19 | $Search::Elasticsearch::Client::8_0::Direct::SQL::VERSION = '8.12'; | ||
| 20 | use Moo; | ||
| 21 | with 'Search::Elasticsearch::Client::8_0::Role::API'; | ||
| 22 | with 'Search::Elasticsearch::Role::Client::Direct'; | ||
| 23 | use namespace::clean; | ||
| 24 | |||
| 25 | __PACKAGE__->_install_api('sql'); | ||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | =pod | ||
| 30 | |||
| 31 | =encoding UTF-8 | ||
| 32 | |||
| 33 | =head1 NAME | ||
| 34 | |||
| 35 | Search::Elasticsearch::Client::8_0::Direct::SQL - Plugin providing SQL for Search::Elasticsearch 8.x | ||
| 36 | |||
| 37 | =head1 VERSION | ||
| 38 | |||
| 39 | version 8.12 | ||
| 40 | |||
| 41 | =head1 SYNOPSIS | ||
| 42 | |||
| 43 | my $response = $es->sql->query( body => {...} ) | ||
| 44 | |||
| 45 | =head2 DESCRIPTION | ||
| 46 | |||
| 47 | This class extends the L<Search::Elasticsearch> client with an C<sql> | ||
| 48 | namespace, to support the | ||
| 49 | L<SQL APIs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html>. | ||
| 50 | |||
| 51 | The full documentation for the SQL feature is available here: | ||
| 52 | L<https://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html> | ||
| 53 | |||
| 54 | =head1 GENERAL METHODS | ||
| 55 | |||
| 56 | =head2 C<query()> | ||
| 57 | |||
| 58 | $response = $es->sql->query( | ||
| 59 | body => {...} # required | ||
| 60 | ) | ||
| 61 | |||
| 62 | The C<query()> method executes an SQL query and returns the results. | ||
| 63 | |||
| 64 | Query string parameters: | ||
| 65 | C<error_trace>, | ||
| 66 | C<filter_path>, | ||
| 67 | C<format>, | ||
| 68 | C<human> | ||
| 69 | |||
| 70 | See the L<query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html> | ||
| 71 | for more information. | ||
| 72 | |||
| 73 | =head2 C<translate()> | ||
| 74 | |||
| 75 | $response = $es->sql->translate( | ||
| 76 | body => {...} # required | ||
| 77 | ) | ||
| 78 | |||
| 79 | The C<translate()> method takes an SQL query and returns the query DSL which would be executed. | ||
| 80 | |||
| 81 | Query string parameters: | ||
| 82 | C<error_trace>, | ||
| 83 | C<filter_path>, | ||
| 84 | C<human> | ||
| 85 | |||
| 86 | See the L<translate docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html> | ||
| 87 | for more information. | ||
| 88 | |||
| 89 | =head2 C<clear_cursor()> | ||
| 90 | |||
| 91 | $response = $es->sql->clear_cursor( | ||
| 92 | body => {...} # required | ||
| 93 | ) | ||
| 94 | |||
| 95 | The C<clear_cursor()> method cleans up an ongoing scroll request. | ||
| 96 | |||
| 97 | Query string parameters: | ||
| 98 | C<error_trace>, | ||
| 99 | C<filter_path>, | ||
| 100 | C<human> | ||
| 101 | |||
| 102 | See the L<query docs|https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-rest.html> | ||
| 103 | for more information. | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | Enrico Zimuel <enrico.zimuel@elastic.co> | ||
| 108 | |||
| 109 | =head1 COPYRIGHT AND LICENSE | ||
| 110 | |||
| 111 | This software is Copyright (c) 2024 by Elasticsearch BV. | ||
| 112 | |||
| 113 | This is free software, licensed under: | ||
| 114 | |||
| 115 | The Apache License, Version 2.0, January 2004 | ||
| 116 | |||
| 117 | =cut | ||
| 118 | |||
| 119 | __END__ |