Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-62359

When writing xattrs from eventing body gets empty spurious "meta: {}" object

    XMLWordPrintable

Details

    • Bug
    • Resolution: User Error
    • Critical
    • None
    • 7.6.2
    • eventing
    • None
    • Untriaged
    • 0
    • Unknown

    Description

      In a recent build couchbase-server on 2024-06-14 (linux debian 10) I ran the test script (you can do this on any collection with vectors I just used the following git repo to set things up)

      https://github.com/jon-strabala/easy-vector-langchain-demo

      This results in 10 items in a collection 'lions', 'tigers', 'bears', 'bicycle', 'car', 'motorcycle', 'rock', 'stone', 'slab', 'block' - note the demo works fine.

      Next I wanted to replicate the vector field called "embedding" in the body as follows:

      1. "embedding_base64" encodes as base64 via Eventing and saved into the body of the document.
      2. "emb" the same as "embedding" form the body BUT in the xattrs of the document.
      3. "emb_base64" same as "embedding_base64" BUT in the xattrs of the document.

      To do this I just used an Eventing function "add_test_xattrs_v2" attached as add_test_xattrs_v2.json the resulting documents have all the correct fields BUT there is an additional field that shouldn't exist:

      "metadata": {}

      This spurious field is in all 10 of the documents.  I will show some examples with data removed.

      Example input data or doc

       

      DOC WITH KEY 0a437faacde04c8291c44956e08a28d6
      {
        "text": "rock",
        "embedding": [0.003445039787303916, -data removed- -0.007594248810858201],
      }
      METADATA
      {
        "meta": {
          "id": "0a437faacde04c8291c44956e08a28d6",
          "rev": "2-17d8f260381000000000000000000000",
          "expiration": 0,
          "flags": 0,
          "type": "json"
        },
        "xattrs": {}
      }
      

      Import and Deploy the Eventing function "add_test_xattrs_v2"

      Example output data or doc why the "metadata": {} object in the document body?

      DOC WITH KEY 0a437faacde04c8291c44956e08a28d6
      {
        "text": "rock",
        "embedding": [0.003445039787303916, -data removed- -0.007594248810858201],
        "metadata": {},
        "embedding_base64": "LcZhO5dBub -data removed- MEecTkt2fi7"
      }
      METADATA
      {
        "meta": {
          "id": "0a437faacde04c8291c44956e08a28d6",
          "rev": "2-17d8f260383000000000000000000000",
          "expiration": 0,
          "flags": 0,
          "type": "json"
        },
        "xattrs": {
          "emb": [0.003445039787303916, -data removed- -0.007594248810858201],
          "emb_base64": "LcZhO5dBub -data removed- MEecTkt2fi7"
        }
      }
      

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            santosh.hegde Santosh Hegde
            jon.strabala Jon Strabala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty