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

[core] Index tags #10441

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

[core] Index tags #10441

wants to merge 8 commits into from

Conversation

tdraier
Copy link
Contributor

@tdraier tdraier commented Jan 31, 2025

fixes: https://github.com/dust-tt/tasks/issues/2047
fixes: https://github.com/dust-tt/tasks/issues/2046

Description

Update schema for tags in ES. Adds a new tags field with keyword, text/standard and text/edge_analyzer .
Update tags when upserting table or document.
Add a backfill for existing docs/tables.
Adds endpoint to query tags

Tests

run simple query to list tags values :

curl -u${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} -H "Content-type: application/json" -XGET "http://localhost:9200/core.data_sources_nodes_3/_search?pretty" -d '{
    "query": {
        "bool": {
            "must": [
                {
                    "prefix": {
                        "tags.edge": "t"
                    }
                },
                {
                    "term": {
                        "data_source_id": "748f425e08b7c01c39dbd627b32a73bf7fa5f83b2499bb997b05f2551a7991e6"
                    }
                }
            ]
        }
    },
    "aggs": {
        "unique_tags": {
            "terms": {
                "field": "tags.keyword",
                "size": 10
            }
        }
    },
    "size": 0
}'

For the same query with core endpoint :

curl -XPOST http://localhost:3001/tags/search --header 'content-type: application/json' -d '{
  "query": "t",
  "query_type": "prefix",
  "data_sources": ["748f425e08b7c01c39dbd627b32a73bf7fa5f83b2499bb997b05f2551a7991e6"]
}'

Risk

Deploy Plan

run migration :

./admin/elasticsearch_run_command_from_file.sh src/search_stores/migrations/20250131_add_tags.http

deploy core

run backfills

cargo run --bin elasticsearch_backfill_document_tags_index -- --index-version 3 --query-type document
cargo run --bin elasticsearch_backfill_document_tags_index -- --index-version 3 --query-type table

@tdraier tdraier changed the title Thomas/tags endpoint [core] Index tags Jan 31, 2025
@tdraier tdraier requested a review from philipperolet January 31, 2025 15:23
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.

1 participant