Giter VIP home page Giter VIP logo

elasticsearch-virtual-schema's Introduction

Elasticsearch Virtual Schema

Build Status

Quality Gate Status

Security Rating Reliability Rating Maintainability Rating Technical Debt

Code Smells Coverage Duplicated Lines (%) Lines of Code'

Overview

The Elasticsearch Virtual Schema provides an abstraction layer that makes an external Elasticsearch data source accessible from an Exasol database through regular SQL commands. The contents of the external Elasticsearch data source are mapped to virtual tables which look like and can be queried as any regular Exasol table.

If you want to set up a Virtual Schema for a different database system, please head over to the Virtual Schemas Repository.

The current version of Elasticsearch Virtual Schema supports Elasticsearch 8.6. If you run Elasticsearch version 7.x please use version 2.0.5 of the virtual schema.

Features

  • Access an Elasticsearch data source in read only mode from an Exasol database, using Virtual Schema.

Table of Contents

Information for Users

Find all the documentation in the Virtual Schemas project.

Information for Developers

elasticsearch-virtual-schema's People

Contributors

chiaradiamarcelo avatar ckunki avatar jakobbraun avatar kaklakariada avatar morazow avatar pj-spoelders avatar tkilias avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

rohankumardubey

elasticsearch-virtual-schema's Issues

๐Ÿ” CVE-2024-25710: org.apache.commons:commons-compress:jar:1.24.0:test

Summary

Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in Apache Commons Compress.This issue affects Apache Commons Compress: from 1.3 through 1.25.0.

Users are recommended to upgrade to version 1.26.0 which fixes the issue.

CVE: CVE-2024-25710
CWE: CWE-835

References

Add support for nested fields

Currently, after creating the VS we can't use nested fields in a Exasol query, as the nested fields are separated by dot(.), and Exasol SQL dialect does not let using dots(.) as quoted parameters.

For example, if we have a "book" index, with an "author" field, which has a "name" field, this will be mapped as "author.name" in Exasol but when executing the SELECT "author.name" FROM VirtualSchema.books query, Exasol will complain.

For this, we need to map the nested fields using a different character instead of a dot(.)

Remove test workaround for failing queries

Some queries using the virtual schema fail when converting numeric types, e.g.

SELECT FLOOR("FIELD") FROM VIRTUAL_SCHEMA."index";
SELECT TRUNC(123.4567, 2) FROM VIRTUAL_SCHEMA."index";

These queries fail with the following error message:

ETL-1299: Failed to create transformator for column=0 (starting from 0 for selected columns) [ETL-1202: Not implemented - Transformation for this combination of column types is not possible in this version. A solution for this problem can be perhaps the conversion in another datatype in the database. Otherwise please contact support for additional information]

This is a bug in Exasol 7.1.17.

Once this is fixed in Exasol we need to adapt the tests to expect correct results again.

Fix CVE-2023-42503 in test dependency `org.apache.commons:commons-compress`

 Error:  Failed to execute goal org.sonatype.ossindex.maven:ossindex-maven-plugin:3.2.0:audit (default-cli) on project elasticsearch-virtual-schema: Detected 1 vulnerable components:
Error:    org.apache.commons:commons-compress:jar:1.22:test; https://ossindex.sonatype.org/component/pkg:maven/org.apache.commons/[email protected]?utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1
Error:      * [CVE-2023-42503] CWE-20: Improper Input Validation (5.5); https://ossindex.sonatype.org/vulnerability/CVE-2023-42503?component-type=maven&component-name=org.apache.commons%2Fcommons-compress&utm_source=ossindex-client&utm_medium=integration&utm_content=1.8.1

Fix security issue in elasticsearch

See failing build: https://github.com/exasol/elasticsearch-virtual-schema/runs/3751354246?check_suite_focus=true

Error:  Failed to execute goal org.sonatype.ossindex.maven:ossindex-maven-plugin:3.1.0:audit (default-cli) on project elasticsearch-virtual-schema: Detected 1 vulnerable components:
Error:    org.elasticsearch:elasticsearch:jar:7.13.4:test; https://ossindex.sonatype.org/component/pkg:maven/org.elasticsearch/[email protected]?utm_source=ossindex-client&utm_medium=integration&utm_content=1.1.1
Error:      * [CVE-2021-22147] Elasticsearch before 7.14.0 did not apply document and field level security to s... (6.5); https://ossindex.sonatype.org/vulnerability/a52f2ab6-086b-4285-a7a1-78ecdc6404ba?component-type=maven&component-name=org.elasticsearch.elasticsearch&utm_source=ossindex-client&utm_medium=integration&utm_content=1.1.1

Fix vulnerabilities and broken links reported by build actions

6 Vulnerabilities

1 Broken link

[โœ–] https://ossindex.sonatype.org/vulnerability/a52f2ab6-086b-4285-a7a1-78ecdc6404ba?component-type=maven&component-name=org.elasticsearch.elasticsearch&utm_source=ossindex-client&utm_medium=integration&utm_content=1.1.1 โ†’ Status: 404

Can probably be fixed by updating project-keeper to latest version which makes broken_links_checker.yml ignore links to opensource.org as they have blocked broken_links_checker.yml due too many requests.

Unknown Virtual Schema Adapter "UNKNOWN" requested.

Hey Guys,

just would like to start with your new ES adapter (great idea!) but unfortunately the adapter didn't work on my site. If followed these instructions

https://github.com/exasol/elasticsearch-virtual-schema/blob/main/doc/dialects/elasticsearch_sql_user_guide.md

and add the latestes jars to bucket fs in the default folder. When I run

curl http://r:[email protected]:1234/default

the files are there:
virtual-schema-dist-8.0.0-elasticsearch-1.0.0.jar
x-pack-sql-jdbc-7.12.0.jar

Afterwards I've created the adapter by

CREATE OR REPLACE JAVA ADAPTER SCRIPT ELASTIC.ES_ADAPTER AS
%scriptclass com.exasol.adapter.RequestDispatcher;
%jar /buckets/bfsdefault/default/virtual-schema-dist-8.0.0-elasticsearch-1.0.0.jar;
%jar /buckets/bfsdefault/default/x-pack-sql-jdbc-7.12.0.jar;
/

and of course I create the connection with

CREATE OR REPLACE CONNECTION ELASTIC_CONNECTION TO 'jdbc:es://http://192.168.178.29:9205/';;

But when I try to create the VS with

CREATE VIRTUAL SCHEMA VIRTUAL_SCHEMA_TEST USING ELASTIC.ES_ADAPTER WITH CONNECTION_NAME = 'ELASTIC_CONNECTION' SCHEMA_NAME = 'ELASTIC';

I receive the above error. Here is the full stack trace:

SQL-Fehler [22002]: VM error:
java.lang.IllegalArgumentException: Unknown Virtual Schema Adapter "UNKNOWN" requested. Currently registered Virtual Schema Adapter factories: "ES"
Stack trace:
com.exasol.adapter.AdapterRegistry.getAdapterForName(AdapterRegistry.java:76)
com.exasol.adapter.RequestDispatcher.findResponsibleAdapter(RequestDispatcher.java:62)
com.exasol.adapter.RequestDispatcher.executeAdapterCall(RequestDispatcher.java:51)
com.exasol.adapter.RequestDispatcher.adapterCall(RequestDispatcher.java:41)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:566)
com.exasol.ExaWrapper.runSingleCall(ExaWrapper.java:95) (Session: 1696051372399491389)

Did I skip a step or is it a bug? I've used the community edition 6.2.4. I would really like to work with this feature. Thanx in advance.

Add support for `AGGREGATE_GROUP_BY_EXPRESSION` capability

ElasticSearchSQL supports expressions in the GROUP BY clause.

The problem is that the default visitor rewrites the binary operators wrapping the expression in brackets, so a query like

SELECT "a" + 1 FROM ESVS."table" GROUP BY "a" + 1

is rewritten to

SELECT "a" + 1 FROM ESVS."table" GROUP BY ( "a" + 1 )

and this fails in the ES database as the brackets are not supported.

Update to VSCJDBC 10.0.1

Update dependencies to use enhanced Datatype Detection For Result Sets from virtual-schemas-common-jdbc

๐Ÿ” CVE-2024-26308: org.apache.commons:commons-compress:jar:1.24.0:test

Summary

Allocation of Resources Without Limits or Throttling vulnerability in Apache Commons Compress.This issue affects Apache Commons Compress: from 1.21 before 1.26.

Users are recommended to upgrade to version 1.26, which fixes the issue.

CVE: CVE-2024-26308
CWE: CWE-770

References

Provide fully installation automation of the virtual schema

At the moment, to fully set-up the virtual schema there are several steps to follow, that might be error prone as they must be done manually in a specific order.

We should automate this.

Perhaps we can take a look at the Java self-contained app feature, and use the bucketfs-java library.

Update tests to V8 VSES

Since 2023-06-02 for version 8.18.1 of Exasol database a Docker image is available on Dockerhub.

The current ticket therefore requests to update the integration tests of VSES to use version 8.18.1 as latest default version.

Please note sibling-tickets for all JDBC-based virtual schemas.

Remove test workaround for issue with invalid DB results

Exasol 7.1.17 returns wrong values for EXTRACT SECOND FROM:

SELECT EXTRACT(SECOND FROM CAST('2018-02-19 10:23:27' AS TIMESTAMP))
FROM VIRTUAL_SCHEMA."index";

This returns 0.027 instead of the expected value 27.

Also see integration test testExtractSecond():

assertExtract("SECOND").withValues("2018-02-19T10:23:27Z").withResult(27).verify()

This is a bug in Exasol 7.1.17.

Currently the expected value is set to 0.027 to make the test pass. Once a new DB release with a fix is available we need to upgrade and adapt the test case.

See also #60 and #64.

Remove Matrix build if possible

The CI build runs with two Exasol versions. To simplify maintenance we should think about if this is required and remove the matrix build if possible.

Update log4j to fix CVE-2021-44228

This project uses log4j versions potentially affected by CVE-2021-44228:

[INFO]    org.apache.logging.log4j:log4j-api:jar:2.11.1:test

Dependency tree:

[INFO] +- org.elasticsearch.client:elasticsearch-rest-high-level-client:jar:7.15.0:test
[INFO] |  +- org.elasticsearch:elasticsearch:jar:7.15.0:test
[INFO] |  |  +- org.elasticsearch:elasticsearch-core:jar:7.15.0:test
[INFO] |  |  +- org.elasticsearch:elasticsearch-secure-sm:jar:7.15.0:test
[INFO] |  |  +- org.elasticsearch:elasticsearch-x-content:jar:7.15.0:test
[INFO] |  |  |  +- org.yaml:snakeyaml:jar:1.26:test
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-core:jar:2.10.4:test
[INFO] |  |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.10.4:test
[INFO] |  |  |  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.10.4:test
[INFO] |  |  |  \- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.10.4:test
[INFO] |  |  +- org.elasticsearch:elasticsearch-geo:jar:7.15.0:test
[INFO] |  |  +- org.apache.lucene:lucene-core:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-analyzers-common:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-backward-codecs:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-grouping:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-highlighter:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-join:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-memory:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-misc:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-queries:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-queryparser:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-sandbox:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-spatial-extras:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-spatial3d:jar:8.9.0:test
[INFO] |  |  +- org.apache.lucene:lucene-suggest:jar:8.9.0:test
[INFO] |  |  +- org.elasticsearch:elasticsearch-cli:jar:7.15.0:test
[INFO] |  |  |  \- net.sf.jopt-simple:jopt-simple:jar:5.0.2:test
[INFO] |  |  +- com.carrotsearch:hppc:jar:0.8.1:test
[INFO] |  |  +- org.lz4:lz4-java:jar:1.8.0:test
[INFO] |  |  +- joda-time:joda-time:jar:2.10.10:test
[INFO] |  |  +- com.tdunning:t-digest:jar:3.2:test
[INFO] |  |  +- org.hdrhistogram:HdrHistogram:jar:2.1.9:test
[INFO] |  |  +- org.apache.logging.log4j:log4j-api:jar:2.11.1:test    <=====
[INFO] |  |  +- org.elasticsearch:jna:jar:5.7.0-1:test
[INFO] |  |  \- org.elasticsearch:elasticsearch-plugin-classloader:jar:7.15.0:test

Adapt to Elasticsearch 8

Integration tests currently use Elasticsearch 7.17.5. Upgrading server and JDBC driver to the latest 8 release (currently 8.3.3), integration tests start failing because the JDBC driver returns slightly different values than before.

Until this is implemented we recommend using Elasticsearch version 7.17.5 for both the server and the JDBC driver.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.