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

Flex Index: Default Index: queries with date values without RFC3339 format returns 0 results

    XMLWordPrintable

Details

    • 1

    Description

      Build: 7.0.0-1939

      • Load dataset attached
      • Create default fts index with keyword analyzer:

        {
          "type": "fulltext-index",
          "name": "default_index",
          "uuid": "5005f41409c983df",
          "sourceType": "gocbcore",
          "sourceName": "default",
          "sourceUUID": "b08aa384fdcd7adfdfe3569237428631",
          "planParams": {
            "maxPartitionsPerPIndex": 171
          },
          "params": {
            "doc_config": {
              "docid_prefix_delim": "",
              "docid_regexp": "",
              "mode": "type_field",
              "type_field": "type"
            },
            "mapping": {
              "analysis": {},
              "default_analyzer": "standard",
              "default_datetime_parser": "dateTimeOptional",
              "default_field": "_all",
              "default_mapping": {
                "default_analyzer": "keyword",
                "dynamic": true,
                "enabled": true
              },
              "default_type": "_default",
              "docvalues_dynamic": true,
              "index_dynamic": true,
              "store_dynamic": false,
              "type_field": "type"
            },
            "store": {
              "indexType": "scorch",
              "mossStoreOptions": {}
            }
          },
          "sourceParams": {}
        }
        

      • Create GSI primary index
      • For the below Flex queries with between, fts index is considered but returns 0 results

         
        Number of results from flex query: select meta().id as id from default USE INDEX (USING FTS, USING GSI) where type = "emp" and ( join_date >= "1979-09-25T12:17:00" and join_date < "2020-05-05T00:01:29.741696") ORDER BY id ASC is 0
         
         
        Number of results from gsi query: select meta().id as id from default where type = "emp" and ( join_date >= "1979-09-25T12:17:00" and join_date < "2020-05-05T00:01:29.741696") order by id asc is 586
        
        

      Explain plan:

      {
          "#operator": "Sequence",
          "~children": [
              {
                  "#operator": "Sequence",
                  "~children": [
                      {
                          "#operator": "IndexFtsSearch",
                          "index": "custom_index",
                          "index_id": "56c7a816ec37cdf8",
                          "keyspace": "default",
                          "namespace": "default",
                          "search_info": {
                              "field": "\"\"",
                              "options": "{\"index\": \"custom_index\"}",
                              "outname": "out",
                              "query": "{\"query\": {\"conjuncts\": [{\"field\": \"type\", \"term\": \"emp\"}, {\"field\": \"join_date\", \"inclusive_max\": false, \"inclusive_min\": true, \"max\": \"2020-05-05T00:01:29.741696\", \"min\": \"1979-09-25T12:17:00\"}]}, \"score\": \"none\"}"
                          },
                          "using": "fts"
                      },
                      {
                          "#operator": "Fetch",
                          "keyspace": "default",
                          "namespace": "default"
                      },
                      {
                          "#operator": "Parallel",
                          "~child": {
                              "#operator": "Sequence",
                              "~children": [
                                  {
                                      "#operator": "Filter",
                                      "condition": "(((`default`.`type`) = \"emp\") and ((\"1979-09-25T12:17:00\" <= (`default`.`join_date`)) and ((`default`.`join_date`) < \"2020-05-05T00:01:29.741696\")))"
                                  },
                                  {
                                      "#operator": "InitialProject",
                                      "result_terms": [
                                          {
                                              "as": "id",
                                              "expr": "(meta(`default`).`id`)"
                                          }
                                      ]
                                  }
                              ]
                          }
                      }
                  ]
              },
              {
                  "#operator": "Order",
                  "sort_terms": [
                      {
                          "expr": "`id`"
                      }
                  ]
              }
          ]
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              abhinav Abhi Dangeti
              girish.benakappa Girish Benakappa
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty