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

FTS: Flex index - ORDER BY query fails for datetime field

    XMLWordPrintable

Details

    • Untriaged
    • Centos 64-bit
    • 1
    • Unknown

    Description

      Build: 7.0.0-4322

      Having the following KV structure:

      `default`.scope1.collection1

      and set of 1000 docs loaded into collection1:

      {
        "mutated": 0,
        "join_date": "2010-05-17T13:46:31",
        "languages_known": [
          "Malay",
          "Vietnamese",
          "Africans"
        ],
        "name": "Treva Cooper",
        "dept": "Info-tech",
        "salary": 61390,
        "type": "emp",
        "is_manager": false,
        "email": "Treva@mcdiabetes.com",
        "emp_id": "10000001"
      }
      

      and the following FTS index:

      {
       "name": "default_index_1",
       "type": "fulltext-index",
       "params": {
        "doc_config": {
         "docid_prefix_delim": "",
         "docid_regexp": "",
         "mode": "scope.collection.type_field",
         "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,
           "properties": {
            "is_manager": {
             "enabled": true,
             "dynamic": false,
             "fields": [
              {
               "index": true,
               "name": "is_manager",
               "type": "boolean"
              }
             ]
            },
            "join_date": {
             "enabled": true,
             "dynamic": false,
             "fields": [
              {
               "index": true,
               "name": "join_date",
               "type": "datetime"
              }
             ]
            },
            "mutated": {
             "enabled": true,
             "dynamic": false,
             "fields": [
              {
               "index": true,
               "name": "mutated",
               "type": "number"
              }
             ]
            },
            "type": {
             "enabled": true,
             "dynamic": false,
             "fields": [
              {
               "index": true,
               "name": "type",
               "type": "text"
              }
             ]
            }
           }
          }
         }
        },
        "store": {
         "indexType": "scorch",
         "mossStoreOptions": {},
         "segmentVersion": 15
        }
       },
       "sourceType": "gocbcore",
       "sourceName": "default",
       "sourceUUID": "8569e7a7b6604b7e9a1e1a84becbf43c",
       "sourceParams": {},
       "planParams": {
        "maxPartitionsPerPIndex": 171,
        "numReplicas": 0,
        "indexPartitions": 6
       },
       "uuid": "35a005af9e13d0b3"
      }
      

      I'm trying to run the following query:

      select meta().id from `default`.scope1.collection1 USE INDEX(USING FTS) 
      where join_date > '2001-10-09' order by join_date ASC LIMIT 10 OFFSET 5
      

      As a result, I'm getting the following response:

      [
        {
          "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 meta().id from `default`.scope1.collection1 USE INDEX(USING FTS) \nwhere join_date > '2001-10-09' order by join_date ASC LIMIT 10 OFFSET 5"
        }
      ]
      

      The following query:

      select meta().id from `default`.scope1.collection1 USE INDEX(USING FTS) 
      where join_date = '2001-10-09' order by join_date ASC LIMIT 10 OFFSET 5
      

      executes successfully.

       

      Attachments

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

        Activity

          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