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

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty