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

FlexIndex: FlexQuery with OR is not using FTS index even though its sargable

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      Build: 7.0.0-1939

      • Load dataset attached
      • Create fts index with below:

        {
          "type": "fulltext-index",
          "name": "custom_index",
          "uuid": "15f8e556c0016faf",
          "sourceType": "gocbcore",
          "sourceName": "default",
          "sourceUUID": "0bb07ed3f6a8fe63615b7fa3b0d08d82",
          "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": {
                "dynamic": true,
                "enabled": false
              },
              "default_type": "_default",
              "docvalues_dynamic": true,
              "index_dynamic": true,
              "store_dynamic": false,
              "type_field": "type",
              "types": {
                "emp": {
                  "dynamic": false,
                  "enabled": true,
                  "properties": {
                    "is_manager": {
                      "dynamic": false,
                      "enabled": true,
                      "fields": [
                        {
                          "include_in_all": true,
                          "include_term_vectors": true,
                          "index": true,
                          "name": "is_manager",
                          "type": "boolean"
                        }
                      ]
                    },
                    "join_date": {
                      "dynamic": false,
                      "enabled": true,
                      "fields": [
                        {
                          "include_in_all": true,
                          "include_term_vectors": true,
                          "index": true,
                          "name": "join_date",
                          "type": "datetime"
                        }
                      ]
                    },
                    "manages": {
                      "dynamic": false,
                      "enabled": true,
                      "properties": {
                        "team_size": {
                          "dynamic": false,
                          "enabled": true,
                          "fields": [
                            {
                              "include_in_all": true,
                              "include_term_vectors": true,
                              "index": true,
                              "name": "team_size",
                              "type": "number"
                            }
                          ]
                        }
                      }
                    },
                    "mutated": {
                      "dynamic": false,
                      "enabled": true,
                      "fields": [
                        {
                          "include_in_all": true,
                          "include_term_vectors": true,
                          "index": true,
                          "name": "mutated",
                          "type": "number"
                        }
                      ]
                    },
                    "name": {
                      "dynamic": false,
                      "enabled": true,
                      "fields": [
                        {
                          "analyzer": "keyword",
                          "include_in_all": true,
                          "include_term_vectors": true,
                          "index": true,
                          "name": "name",
                          "type": "text"
                        }
                      ]
                    }
                  }
                }
              }
            },
            "store": {
              "indexType": "scorch",
              "mossStoreOptions": {}
            }
          },
          "sourceParams": {}
        }
        

      • Create GSI primary index
      • For the below flex query with OR, it uses GSI primary index even though FTS index has name, mutated and with type mapping emp

        select meta().id from default USE INDEX (  USING FTS) where type = "emp" and (name>= "Scott" and name <="Vala" ) or mutated = 0
        

      Attachments

        Issue Links

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

          Activity

            People

              girish.benakappa Girish Benakappa
              girish.benakappa Girish Benakappa
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty