How to Configure Your Elasticsearch Backend

Use the following procedure to configure the Elasticsearch backend.

Prerequisites

  • Elasticsearch v7.x must be installed.
  • If Elasticsearch is not installed, download Elasticsearch and install it.

Connect SmartHub to an Elastic Cloud or Self-hosted Elasticsearch On-Premise Instance

Make sure that you have the following information and access for the backend(s) that you are configuring:

  • Elastic Cloud URL
  • Access to Elasticsearch On-Premise

Add an Elastic Backend

  1. Navigate to the SmartHub Administration page at http(s)://[web-app-url]/_admin.
    1. For example: http://smarthub.azurewebsites.net/_admin.
  2. From the General Settings page click the "Add New Backend" link to add your new Elasticsearch backend.
  3. Next, enter the Backend Name and corresponding information in the appropriate fields. See the following graphic.


  4. Backend type: Select ElasticBackend or ElastcBackendAws (for AWS hosted Elastic Search service) from the drop-down list.


  5. Rank offset formula coefficients

    • Optional.

    • Enter these values only if you selected the Rank Based mixing algorithm that is set in the Properties for SSA page:

      • BOOST: Enter the boost factor.

      • OFFSET: Enter the rank offset.

Authentication Mode

These are the credentials that are used to access the Elasticsearch service.

Select the authentication mode for your environment's Elasticsearch type, detailed below.

Available authentication modes:

  • None
  • Basic
  • Token


AWS-hosted Elastic

  • AWS Access Key:

    • Enter your access key

  • AWS Secret Key:

    • Enter your secret key

  • Authenticate via AWS Profiles:
    • Store profiles in a share AWS credentials file and use to access AWS Elastic Backend content.
    • Note: The file must be saved with an .ini extension:
      • Example: credentials.ini
    • AWS Profile name: 
      • Enter AWS profile name.
      • Example: basic_profile
    • AWS Credentials file location:
      • Enter the location of AWS Credential file.
      • Example: C:\\Users\sdkuser\customCredentialsFile.ini
Example AWS Credentials File
[{profile_name}]
aws_access_key_id = {accessKey}
aws_secret_access_key = {secretKey}

All On-Premise Cloud Elasticsearch Instances

For any on-premise instance of Cloud Elastic Search service (not AWS-hosted elastic):

Authentication mode

  • Basic
    • Account: Enter your account name.
    • Password: Enter your password.
  • Token Based
    • How to configure Token-Based Authentication can be found here.
  1. Modify the Backend configuration by entering your configuration settings into the Parameters field.
    See the following example code:

    Backend Configuration Example

    Copy
    <configuration>       
        <settings>             
            <setting Name='ElasticServerAddress' Value='http://localhost:9200' />             
            <setting Name='Indices' Value='index1, index2' />             
            <setting Name='Timeout' Value='30' />             
            <setting Name='SourceMappings' Value='00000000-0000-0000-0000-000000000000#index1,index2;' />     
        </settings>
    </configuration>
    1. Use the following table to specify this code:

      Parameter Description Default Value

      ElasticServerAddress

      Required.

      The URL of your Elastic Cloud service instance.

      Obtain this URL from your Elastic Could provider.

      http://localhost:9200

      Indices

      Required.

      Specify one or more comma (,) separated indices to be used for search.

      index1,index2

      Timeout

      Optional.

      Specify the configurable timeout of the search.
      Note: If the search takes longer than 30 seconds, the search is cancelled.

      30

      SourceMappings

      Optional.

      A mapping between SearchQuery.SourceId and Elasticsearch indices.

      A Search Query with a matching Source ID is executed against the specified indices.

      This option is used for performance tweaks when you have multiple backends.

      00000000-0000-0000-0000-000000000000#index1,index2

Pipeline Stages

After creating the Backend, two "Elastic translator" pipeline stages are automatically added to the pipeline categories:

  • Query Pipeline Stage

  • Result Pipeline Stage

Make the modifications


  • These are backend-specific pipeline stages and do not apply to any other backends you have configured.

Perform the following steps for both the Query Pipeline and Results Pipeline Elastic Translator stages:

  1. Click the stage name.
  2. Modify the Stage Configuration by entering your configuration settings into the Parameters field.
    See the following example code.

    Stage Configuration Example

    Copy
    <configuration>         
        <settings>               
            <setting Name='Indices' Value='index1,index2' />               
            <setting Name='RefinablePropertiesSuffix' Value='' />               
            <setting Name='HighlightTagContent' Value='c0' />               
            <setting Name='Timeout' Value='30' />               
            <setting Name='EnableFuzziness' Value='true' />               
            <setting Name='TextQueryType' Value='best_fields' />               
            <setting Name='DateProperties' Value='ElasticLastUpdate' />               
            <setting Name='NumericProperties' Value='FileSize' />               
            <setting Name='SourceMappings' Value='00000000-0000-0000-0000-000000000000#index1,index2;' />               
            <setting Name='FieldBoost' Value='' />               
            <setting Name='ShowAccurateResultCount' Value='false' />                
            <setting Name='BodyField' Value='FileContent' />           
        </settings>
    </configuration>
    1. Use the following table to specify this code:

Parameter Description Default Value

Indices

Required

Specify one or more comma (,) separated indices to be used for search.

index1,index2

RefinablePropertiesSuffix

Optional

Suffix to append to the Elasticsearch field name when building an aggregation on top of it.

                                

HighlightTagContent

Optional.

HTML element to be used as a wrapper for the highlighted terms

c0

Timeout

Optional.

Specify the configurable timeout of the search.
Note: if the search takes longer than 30 seconds, the search is cancelled.

30

EnableFuzziness

Optional

The fuzzy query uses similarity based on Levenshtein edit distance.

false

TextQueryType

Optional.

The multi_match query builds on the match query to enable multi-field queries

best_fields

DateProperties

Optional

Specify the date properties that are to be used as refiners

ElasticLastUpdate

NumericProperties

Optional

Specify the numeric properties that are to be used as refiners

FileSize

SourceMappings

Optional.

  • A mapping between SearchQuery.SourceId and Elasticsearch indices.

  • A Search Query with a matching Source ID is executed against the specified indices.

  • This option is used for performance tweaks when you have multiple backends.

00000000-0000-0000-0000-000000000000#index1,index2
FieldBoost

Optional

  • Use the boost operator ^ to make one term more relevant than another.

  • The default boost value is 1, but can be any positive floating point number.

  • Boosts between 0 and 1 reduce relevance.

  • Example: escbase_author^3,escbase_fileextention^0.3

Note that the field names should be taken from elastic, not from the property mapper. 


ShowAccurateResultCount

Specify if the elastic max count of 10000 results or the accurate count is used.

Enabling this might affect the performance

false
BodyField

Optional

  • Specify the field care corresponds to the body field.

  • If the elastic index is created (or updated) with CH 2.x the setting should be set to FileContent.

  • If the elastic index is created (or updated) with CH 3.x the setting should be set to escbase_fulltextcontent.

Note that if the setting is missing the default value will be used.

FileContent

Logs

By default, logs appear in the directory <SmartHub_Install_Directory>\Logging.

Note: Operator NEAR
Elastic Backend supports operatorNEAR.
Supported syntax:

  1. (A OR B) NEAR(5) C => "A C"~5 OR "B C"~5
  2. (A OR B) NEAR(5) (C OR D) => "A C"~5 OR "B C"~5  OR "A D"~5 OR "B D"~5
  3. (A OR "B C") NEAR(5) D => "A D"~5 OR ("B C D"~5 AND "B C")
  4. (A AND B AND C) NEAR(5) (D AND E) =>"A B C D E"~5