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

Hits obtained from an index alias over multi-collection indexes contain prefixed collection bytes

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      Here's a sample search response for a query over an index alias ..

      AD: ~/Documents/couchbaseCC/ns_server $ curl -XPOST -H "Content-type:application/json" http://Administrator:asdasd@127.0.0.1:9200/api/index/airlines/query -d '{"query": {"query": "edit"}}' | jq
        % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                       Dload  Upload   Total   Spent    Left  Speed
      100   852  100   824  100    28   4603    156 --:--:-- --:--:-- --:--:--  4759
      {
        "status": {
          "total": 2,
          "failed": 0,
          "successful": 2
        },
        "request": {
          "query": {
            "query": "edit"
          },
          "size": 10,
          "from": 0,
          "highlight": null,
          "fields": null,
          "facets": null,
          "explain": false,
          "sort": [
            "-_score"
          ],
          "includeLocations": false,
          "search_after": null,
          "search_before": null
        },
        "hits": [
          {
            "index": "temp_144737e315264058_4c1c5584",
            "id": "\b\u0000\u0000\u0000one",
            "score": 0.2972674459459178,
            "sort": [
              "_score"
            ]
          },
          {
            "index": "default_2d9ca20632cb632e_4c1c5584",
            "id": "\t\u0000\u0000\u0000two",
            "score": 0.2972674459459178,
            "sort": [
              "_score"
            ]
          },
          {
            "index": "temp_144737e315264058_4c1c5584",
            "id": "\t\u0000\u0000\u0000two",
            "score": 0.2972674459459178,
            "sort": [
              "_score"
            ]
          },
          {
            "index": "default_2d9ca20632cb632e_4c1c5584",
            "id": "\b\u0000\u0000\u0000one",
            "score": 0.2972674459459178,
            "sort": [
              "_score"
            ]
          }
        ],
        "total_hits": 4,
        "max_score": 0.2972674459459178,
        "took": 276179,
        "facets": null
      } 

      So the hit IDs in the search response would look like this ..

      \t\u0000\u0000\u0000two 

      And because of this, the docID links on the UI wouldn't work either.

      The fix is to decorate document hits for search responses from an index alias ..

      1. Strip collection bytes from the ID
      2. Add _$c to the hit.Fields, which is used to look up the source document by the document viewer.

      Attachments

        For Gerrit Dashboard: MB-48408
        # Subject Branch Project Status CR V

        Activity

          Build couchbase-server-7.1.0-1285 contains cbft commit 4cfcf12 with commit message:
          MB-48408: Strip collection UID from hit IDs obtained for an index alias

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-1285 contains cbft commit 4cfcf12 with commit message: MB-48408 : Strip collection UID from hit IDs obtained for an index alias

          Build couchbase-server-7.0.2-6672 contains cbft commit 919202c with commit message:
          MB-48408: collID processing for multi-collection index alias

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.0.2-6672 contains cbft commit 919202c with commit message: MB-48408 : collID processing for multi-collection index alias

          Build couchbase-server-7.1.0-1287 contains cbft commit 919202c with commit message:
          MB-48408: collID processing for multi-collection index alias

          build-team Couchbase Build Team added a comment - Build couchbase-server-7.1.0-1287 contains cbft commit 919202c with commit message: MB-48408 : collID processing for multi-collection index alias

          Verified for 7.1.0-1287

          Alias query for alias containing multi-collection indexes returns correct doc ids. 

          evgeny.makarenko Evgeny Makarenko (Inactive) added a comment - Verified for 7.1.0-1287 Alias query for alias containing multi-collection indexes returns correct doc ids. 

          Verified for 7.0.2-6672

          evgeny.makarenko Evgeny Makarenko (Inactive) added a comment - Verified for 7.0.2-6672

          People

            evgeny.makarenko Evgeny Makarenko (Inactive)
            abhinav Abhinav Dangeti
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty