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

N1QL-FTS Integration phase 2: FTSClient not selecting index with custom mapping in some cases

    XMLWordPrintable

Details

    • Untriaged
    • Centos 64-bit
    • Unknown

    Description

      Build: 6.5.0 build 2832 

      Cluster configuration:

      • standard `default` bucket
      • no GSI indexes
      • FTS index:

        {
         "name": "custom_index",
         "type": "fulltext-index",
         "params": \{
          "doc_config": {
           "docid_prefix_delim": "",
           "docid_regexp": "",
           "mode": "type_field",
           "type_field": "type"
          },
          "mapping": \{
           "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": {
              "manages": {
               "dynamic": false,
               "enabled": true,
               "properties": {
                "reports": {
                 "enabled": true,
                 "dynamic": false,
                 "fields": [
                  {
                   "analyzer": "standard",
                   "include_in_all": true,
                   "include_term_vectors": true,
                   "index": true,
                   "name": "reports",
                   "type": "text"
                  }
                 ]
                }
               }
              },
              "email": \{
               "enabled": true,
               "dynamic": false,
               "fields": [
                {
                 "analyzer": "en",
                 "include_in_all": true,
                 "include_term_vectors": true,
                 "index": true,
                 "name": "email",
                 "type": "text"
                }
               ]
              },
              "join_date": \{
               "enabled": true,
               "dynamic": false,
               "fields": [
                {
                 "include_in_all": true,
                 "include_term_vectors": true,
                 "index": true,
                 "name": "join_date",
                 "type": "datetime"
                }
               ]
              },
              "mutated": \{
               "enabled": true,
               "dynamic": false,
               "fields": [
                {
                 "include_in_all": true,
                 "include_term_vectors": true,
                 "index": true,
                 "name": "mutated",
                 "type": "number"
                }
               ]
              },
              "name": \{
               "enabled": true,
               "dynamic": false,
               "fields": [
                {
                 "analyzer": "keyword",
                 "include_in_all": true,
                 "include_term_vectors": true,
                 "index": true,
                 "name": "name",
                 "type": "text"
                }
               ]
              }
             }
            }
           }
          },
          "store": \{
           "indexType": "scorch",
           "kvStoreName": "mossStore",
           "mossStoreOptions": {}
          }
         },
         "sourceType": "couchbase",
         "sourceName": "default",
         "sourceUUID": "f424775c2182aa574ef2965ae19ccf37",
         "sourceParams": null,
         "planParams": \{
          "maxPartitionsPerPIndex": 171,
          "numReplicas": 0
         },
         "uuid": "295531dfb94aeb05"
        }
        

       

      Trying to run the following query:

      select meta().id from default where type='emp' and search(default, {"disjuncts": [{"field": "manages.reports", "match": "Beryl"}, {"field": "name", "match": "Nicol\u00e1s"}]})

      Getting the following error as a response:

      [
       {
       "code": 4000,
       "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.",
       "query": "select meta().id from default where type='emp' and search(default, {\"disjuncts\": [{\"field\": \"manages.reports\", \"match\": \"Beryl\"}, {\"field\": \"name\", \"match\": \"Nicol\\u00e1s\"}]})"
       }
      ]

      Investigations gave the following results:

      query

      select meta().id from default where search(default, {"field": "manages.reports", "match": "Beryl"}) and type='emp'

      runs successfully, I can find this in explain plan:

      "~children": [
       {
       "#operator": "IndexFtsSearch",
       "index": "custom_index",
       "index_id": "295531dfb94aeb05",
       "keyspace": "default",
       "namespace": "default",
       "search_info": {
       "field": "\"\"",
       "outname": "out",
       "query": "{\"field\": \"manages.reports\", \"match\": \"Beryl\"}"
       },
       "using": "fts"
       },
      ...

      But if I'm trying to run this:

      select meta().id from default where search(default, {"field": "name", "match": "Nicol\u00e1s"}) and type='emp'

      I'm getting an error - 

      [
        {
          "code": 4000,
          "msg": "No index available on keyspace default that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.",
          "query": "/*select meta().id from default where type='emp' and search(default, {\"disjuncts\": [{\"field\": \"manages.reports\", \"match\": \"Beryl\"}, {\"field\": \"name\", \"match\": \"Nicol\\u00e1s\"}]})*/\nselect meta().id from default where search(default, {\"field\": \"name\", \"match\": \"Nicol\\u00e1s\"}) and type='emp'"
        }
      ]
      

      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:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty