Feature/elasticsearch handler update: fix array support and standardize format#11552
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
🔒 Entelligence AI Vulnerability Scanner ❌ Security analysis failed: Security analysis failed: 403: blocked: error while getting the team: team is blocked |
|
I have read the CLA Document and I hereby sign the CLA |
3eeae43 to
4b1dea7
Compare
610da93 to
be158ee
Compare
ZoranPandovski
left a comment
There was a problem hiding this comment.
Thanks, please check my comments
…tabaseHandler Migrate Elasticsearch handler to inherit from MetaDatabaseHandler to comply with data catalog specifications per review feedback on PR mindsdb#11552. Key changes: - Change base class from DatabaseHandler to MetaDatabaseHandler - Rename methods with meta_ prefix per data catalog API requirements - Add meta_get_tables and meta_get_columns required methods - Update column names to uppercase specification (TABLE_NAME, COLUMN_NAME, etc.) - Calculate NULL_PERCENTAGE as percentage (0.0-100.0) instead of count - Support multiple tables via Optional[List[str]] parameter - Remove data catalog documentation from README - Delete deprecated handler test files, consolidate tests in unit/handlers - Update all 18 unit tests to match new API - Maintain backward compatibility by preserving old methods All tests passing (18/18) and pre-commit checks passed.
|
@MinuraPunchihewa All comments addressed! Here's a summary: Removed Data Catalog documentation sections from README |
richardokonicha
left a comment
There was a problem hiding this comment.
I have consolidated all tests to tests/unit/handlers/test_elasticsearch.py
MinuraPunchihewa
left a comment
There was a problem hiding this comment.
@richardokonicha This looks good. The only other ask that I have is for you to test this with our open-source agents. This will be a good smoke test for whether it will actually work with Minds, which is what we want. You can follow these steps:
*As a prerequisite, set the MINDSDB_DATA_CATALOG_ENABLED environment variable to true before starting MindsDB:
export MINDSDB_DATA_CATALOG_ENABLED=1
- Create a MindsDB database for Elasticsearch.
- Create an Agent connected to the Elasticsearch database:
CREATE AGENT my_agent
USING
model = {
"provider": "openai",
"model_name" : "gpt-4o",
"api_key": "<your-api-key>"
},
data = {
"tables": ["elasticsearch_conn.<table-1>", "elasticsearch_conn.<table-2>"]
},
prompt_template='
<an-explanation-of-the-data-contained-in-your-tables>
';
- Ask a few questions and evaluate if the answers are accurate.
If you can post a few screenshots of this working well, I think we should be good to go.
|
@richardokonicha For the tests to run, you will also need to add a line to install the dependencies for the Elasticsearch integration to the workflow here. You just need to add |
|
@MinuraPunchihewa this branch has been updated and now all tests pass gracefully, here is a short video i made to demo this elastic search functionality https://youtu.be/FGfXqtKxdWY |
|
@richardokonicha hey man, can you please resolve the issues with this PR ? |
…d add to CI - Fix array field handling (convert to JSON strings) - Add Data Catalog support (get_column_statistics, get_primary_keys, get_foreign_keys) - Standardize documentation format - Add elasticsearch to tests_unit.yml HANDLERS_TO_INSTALL for CI testing Addresses maintainer feedback on PR mindsdb#11552
4be4ec4 to
aa03cd9
Compare
|
@tino097 Hey! Branch is synced with Changes in this PR:
Ready for review. |
|
@tino097 Done — removed Regarding Let me know if anything else needs adjusting! |
Description
Improve the Elasticsearch handler by fixing array field handling, adding Data Catalog support for enterprise integration, and standardizing documentation format to match MindsDB conventions.
This PR addresses the "Arrays not supported" error that users encounter when querying Elasticsearch indices with array fields, implements the three required Data Catalog methods
(
get_column_statistics,get_primary_keys,get_foreign_keys), and ensures the handler follows MindsDB's standard documentation format.Demo Video:
Array support showcase and feature overview
[Elastic search demo with data catalog feature]
(https://youtu.be/FGfXqtKxdWY)
Type of change
Verification Process
To ensure the changes are working as expected:
/mindsdb/integrations/handlers/elasticsearch_handler/tests/SELECT * FROM elasticsearch_conn.products WHERE product_id = '12345'(arrays converted to JSON strings)SELECT * FROM mindsdb.get_column_statistics('elasticsearch_conn', 'products')SELECT table_name FROM information_schema.tables WHERE table_schema = 'elasticsearch_conn'for schema discoveryAdditional Media:
Checklist: