Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/es query filter (🚨 URGENT) #2162

Merged
merged 3 commits into from
Jan 21, 2025
Merged

Conversation

alohays
Copy link
Contributor

@alohays alohays commented Jan 20, 2025

Description

🚨 URGENT: This PR fixes critical Elasticsearch query errors that are currently affecting production vector searches.

The current implementation is causing search failures due to incorrect query structure and inefficient index settings. This PR provides essential fixes by:

  1. Fixing KNN query structure that was causing search failures
  2. Adding proper index settings (shards, replicas, refresh interval)
  3. Restructuring mapping to use a more efficient schema
  4. Optimizing KNN search with pre-filtering
  5. Unifying metadata handling under a single field
  6. Improving query performance with term-level filters

These changes will resolve the current search failures and make the vector store more reliable and scalable.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • Unit Test
  • Manual testing with sample vectors and queries
  • Verified fixes for previously failing queries

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective
  • New and existing unit tests pass locally with my changes

Breaking Changes

  1. Changed field name from embedding to vector
  2. Moved user_id under metadata object
  3. Changed payload storage structure to use metadata field instead of payload

Migration will be required for existing indices.

Note to Reviewers

This PR requires immediate attention as it addresses critical search functionality issues in production. The changes have been thoroughly tested and are ready for review.

@deshraj deshraj requested a review from Dev-Khant January 20, 2025 20:35
@Dev-Khant Dev-Khant merged commit f13f3b9 into mem0ai:main Jan 21, 2025
5 checks passed
@Dev-Khant
Copy link
Member

Hey @alohays Thanks for the PR. New version - 0.1.46 is now available with these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants