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

FTS: Flex index - doc_id like query fails.

    XMLWordPrintable

Details

    • Untriaged
    • Centos 64-bit
    • 1
    • Unknown

    Description

      Build: 7.0.0-4332

      Create kv: `default`.scope1.collection1

      Load 1000 docs into collection1, all docs look like:

      {
        "mutated": 0,
        "join_date": "1953-06-19T04:47:33",
        "languages_known": [
          "German",
          "Chinese",
          "French"
        ],
        "manages": {
          "reports": [
            "Cynara Richardson IX",
            "Ambika Miller XII",
            "Perdita Lewis",
            "Killian Wright",
            "Beryl Wood",
            "Severin Carter",
            "Callia Mitchell",
            "Chatha Palmer"
          ],
          "team_size": 8
        },
        "name": "Casondrah Josué",
        "dept": "Pre-sales",
        "salary": 102870,
        "type": "emp",
        "is_manager": true,
        "email": "Casondrah@mcdiabetes.com",
        "emp_id": "10000001"
      }
      

      meta().id looks like

      emp1
      ....
      emp1000

      Trying to use the following fts index

      {
       "name": "default_index_1",
       "type": "fulltext-index",
       "params": {
        "doc_config": {
         "docid_prefix_delim": "emp",
         "docid_regexp": "",
         "mode": "scope.collection.docid_prefix",
         "type_field": "type"
        },
        "mapping": {
         "default_analyzer": "keyword",
         "default_datetime_parser": "dateTimeOptional",
         "default_field": "_all",
         "default_mapping": {
          "dynamic": false,
          "enabled": false
         },
         "default_type": "_default",
         "docvalues_dynamic": true,
         "index_dynamic": true,
         "store_dynamic": false,
         "type_field": "_type",
         "types": {
          "scope1.collection1": {
           "default_analyzer": "keyword",
           "dynamic": true,
           "enabled": true
          }
         }
        },
        "store": {
         "indexType": "scorch",
         "mossStoreOptions": {},
         "segmentVersion": 15
        }
       },
       "sourceType": "gocbcore",
       "sourceName": "default",
       "sourceUUID": "7cafbfe31ebd85b39a4f720b8a1d583b",
       "sourceParams": {},
       "planParams": {
        "maxPartitionsPerPIndex": 171,
        "numReplicas": 0,
        "indexPartitions": 6
       },
       "uuid": "1d574773a8779015"
      }
      

      to execute the following query:

      select count(*) from `default`.scope1.collection1 USE INDEX(USING FTS) where meta().id LIKE 'emp%'
      

      Server response is:

      [
        {
          "code": 4000,
          "msg": "No index available on keyspace `default`:`default`.`scope1`.`collection1` that matches your query. Use CREATE PRIMARY INDEX ON `default`:`default`.`scope1`.`collection1` to create a primary index, or check that your expected index is online.",
          "query": "select count(*) from `default`.scope1.collection1 USE INDEX(USING FTS) where meta().id LIKE 'emp%'"
        }
      ]
      

      Attachments

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

        Activity

          Evgeny Makarenko In the scope.collection.docid_prefix mode, `meta.id LIKE "emp%"` becomes the condition expression - so not searchable. You would need to add another expression along side it to obtain results.

           select count(*) from `default`.scope1.collection1 USE INDEX(USING FTS) where meta().id LIKE 'emp%' AND name = "blah"

          This behavior is analogous to when using the scope.collection.type_field mode when `type = "emp"` becomes the necessary condition expression - which again will need another expression to go along with it, such as ..

          select count(*) from `default`.scope1.collection1 USE INDEX(USING FTS) where type = "meta" AND name = "blah" 

          abhinav Abhinav Dangeti added a comment - Evgeny Makarenko  In the scope.collection.docid_prefix mode, `meta.id LIKE "emp%"` becomes the condition expression - so not searchable. You would need to add another expression along side it to obtain results. select count(*) from ` default `.scope1.collection1 USE INDEX(USING FTS) where meta().id LIKE 'emp%' AND name = "blah" This behavior is analogous to when using the scope.collection.type_field mode when `type = "emp"` becomes the necessary condition expression - which again will need another expression to go along with it, such as .. select count(*) from ` default `.scope1.collection1 USE INDEX(USING FTS) where type = "meta" AND name = "blah"

          All doc id related tests are modified.

          evgeny.makarenko Evgeny Makarenko (Inactive) added a comment - All doc id related tests are modified.

          People

            evgeny.makarenko Evgeny Makarenko (Inactive)
            evgeny.makarenko Evgeny Makarenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty