Search Index Types Templates

Fabric enables adding templates for Search fields when the default settings do not match a search's needs. For example, to search by fields that contain special characters like an email address.

  • Each template is in JSON format and creates index settings in Elasticsearch.
  • All templates must be saved in the Fabric server under the $K2_HOME/config/cdc-tags directory.
  • Fabric has default templates that are saved under the cdc-tags directory:

Template Name

Elasticsearch Analyzer or Tokenizer

Use Case

Example

case-insensitive-match.json

Keyword + lowercase

Case insensitive search for special characters. For example, search by an email address.

  • JohnD@gmail.com matches johnd@gmail.com
  • JohnD@gmail does not match JohnD@yahoo.com

predictive-search.json

edge_ngram

Predictive search.

  • Typing "s" returns "search", "see", or "sql".
  • Typing "se" returns "search" or "see".

precision-match-20.json

1gram – 20gram

Partial match. For example, at least 4 digits must exist and at least 50% of them must be in the correct order in the searched value.

This template supports a maximal length of 20 chars/digits in the searched value.

  • "1243", "56347712", or "654331234" matches "1234".
  • "7777712" or "8751883724" does not match "1234".

Adding the Templates to the Types List for Search Columns

  1. Go to the project tree, right click the project name > Open Folder.

  2. Open the [project name].k2proj file to be edited.

  3. Edit the Search options under the DataChangeIndicators tag and add the template names to the Options tag. The following example displays adding a precision-match-20 template:

   <DataChangeIndicators>
       <DataChange name="Search" enabled="true">
         <Options>
           <option>keyword</option>
           <option>data</option>
           <option>date</option>
           <option>precision-match-20</option>
         </Options>
  1. Save and close the .k2proj file.

  2. Close and reopen the project to reload the updated .k2proj file.

  3. When creating a new Search index, you can also select the added template as a Type.

Using N-gram Search Templates

It is recommended to limit the number of Search fields based on N-gram tokenizer like predictive-search and precision-match-20 templates due to the extremely large disk space required to store these fields. For example:

  • The predictive-search template is based on the Edge-n-gram tokenizer. The following tokens are created for 'Tali'-

    • 't', 'ta', 'tal', 'tali'
  • The precision-match-20 template is based on the N-gram tokenizer. The following tokens are created for 'John Doe'-

    • 1gram: 'j', 'o', 'h', 'n', 'd', 'o', 'e'
    • 2gram: 'jo', 'oh', 'hn', 'nd', 'do', 'oe'
    • 3gram: 'joh', 'ohn', 'hnd', 'ndo', 'doe'
    • 4gram: 'john', 'ohnd', 'hndo', 'ndoe'
    • 5gram: 'johnd', 'ohndo', 'hndoe'
    • 6gram: 'johndo', 'ohndoe'
    • 7gram : 'johndoe'

Update Search Columns Using Templates

Fabric only supports using templates on Search fields when the template is set as a type during the first deployment of the corresponding LU table. This is because Fabric creates an index in Elasticsearch for each LU Table that has Search fields. Using a template on a Search field requires different index settings in Elasticsearch.

Since the index settings cannot be changed once created in Elasticsearch, to update a Search field from a supported Elasticsearch type to a template, do the following:

  • Create an index with the update settings in Elasticsearch.

  • Re-index the data from the old Elasticsearch index to the new index.

  • Drop the old Elasticsearch index.

  • Add an alias with the same settings as the previous index to the new Elasticsearch index.

    Click for more information about creating Elasticsearch indexes.

    Previous

Search Index Types Templates

Fabric enables adding templates for Search fields when the default settings do not match a search's needs. For example, to search by fields that contain special characters like an email address.

  • Each template is in JSON format and creates index settings in Elasticsearch.
  • All templates must be saved in the Fabric server under the $K2_HOME/config/cdc-tags directory.
  • Fabric has default templates that are saved under the cdc-tags directory:

Template Name

Elasticsearch Analyzer or Tokenizer

Use Case

Example

case-insensitive-match.json

Keyword + lowercase

Case insensitive search for special characters. For example, search by an email address.

  • JohnD@gmail.com matches johnd@gmail.com
  • JohnD@gmail does not match JohnD@yahoo.com

predictive-search.json

edge_ngram

Predictive search.

  • Typing "s" returns "search", "see", or "sql".
  • Typing "se" returns "search" or "see".

precision-match-20.json

1gram – 20gram

Partial match. For example, at least 4 digits must exist and at least 50% of them must be in the correct order in the searched value.

This template supports a maximal length of 20 chars/digits in the searched value.

  • "1243", "56347712", or "654331234" matches "1234".
  • "7777712" or "8751883724" does not match "1234".

Adding the Templates to the Types List for Search Columns

  1. Go to the project tree, right click the project name > Open Folder.

  2. Open the [project name].k2proj file to be edited.

  3. Edit the Search options under the DataChangeIndicators tag and add the template names to the Options tag. The following example displays adding a precision-match-20 template:

   <DataChangeIndicators>
       <DataChange name="Search" enabled="true">
         <Options>
           <option>keyword</option>
           <option>data</option>
           <option>date</option>
           <option>precision-match-20</option>
         </Options>
  1. Save and close the .k2proj file.

  2. Close and reopen the project to reload the updated .k2proj file.

  3. When creating a new Search index, you can also select the added template as a Type.

Using N-gram Search Templates

It is recommended to limit the number of Search fields based on N-gram tokenizer like predictive-search and precision-match-20 templates due to the extremely large disk space required to store these fields. For example:

  • The predictive-search template is based on the Edge-n-gram tokenizer. The following tokens are created for 'Tali'-

    • 't', 'ta', 'tal', 'tali'
  • The precision-match-20 template is based on the N-gram tokenizer. The following tokens are created for 'John Doe'-

    • 1gram: 'j', 'o', 'h', 'n', 'd', 'o', 'e'
    • 2gram: 'jo', 'oh', 'hn', 'nd', 'do', 'oe'
    • 3gram: 'joh', 'ohn', 'hnd', 'ndo', 'doe'
    • 4gram: 'john', 'ohnd', 'hndo', 'ndoe'
    • 5gram: 'johnd', 'ohndo', 'hndoe'
    • 6gram: 'johndo', 'ohndoe'
    • 7gram : 'johndoe'

Update Search Columns Using Templates

Fabric only supports using templates on Search fields when the template is set as a type during the first deployment of the corresponding LU table. This is because Fabric creates an index in Elasticsearch for each LU Table that has Search fields. Using a template on a Search field requires different index settings in Elasticsearch.

Since the index settings cannot be changed once created in Elasticsearch, to update a Search field from a supported Elasticsearch type to a template, do the following:

  • Create an index with the update settings in Elasticsearch.

  • Re-index the data from the old Elasticsearch index to the new index.

  • Drop the old Elasticsearch index.

  • Add an alias with the same settings as the previous index to the new Elasticsearch index.

    Click for more information about creating Elasticsearch indexes.

    Previous