Skip to content

Web.config Settings

Phil Oyston edited this page Jun 5, 2017 · 6 revisions

There are a number of configuration settings that are by default configured and read from the <appSettings /> section of the Web.config.

Required settings

When you first install the library the following application settings will be created within your Web.config file:

<appSettings>
 <add key="umbElasticsearch:Host" value="http://localhost:9200" />
 <add key="umbElasticsearch:IndexName" value="umb-elasticsearch" />
 <add key="umbElasticsearch:IndexEnvironmentPrefix" value="%COMPUTERNAME%" />
</appSettings>

umbElasticsearch:Host

Sets a value indicating the endpoint address of your Elasticsearch cluster, the value supports the inclusion of basic auth parameters such as https://user:pass@localhost:9200.

umbElasticsearch:IndexName

Sets a value indicating the name of the index that will be created and managed for storing and searching documents

umbElasticsearch:IndexEnvironmentPrefix

Sets a value indicating a prefix string that will by default be prefixed onto the umbElasticsearch:IndexName value to produce a unique index name for an environment. This setting will attempt to expand any environment variables within the value.

This setting is useful for configuring a development environment in which all developers share an Elasticsearch cluster but want to have a unique index for their computer.

If you do not want to use an index prefix set the value to an empty string as removing the setting altogether will default its value to %COMPUTERNAME%:

 <add key="umbElasticsearch:IndexEnvironmentPrefix" value="" />

Advanced configuration options

There are other configuration options that start with sensible default values but can be overridden if desired, these options are listed below.

IndexBatchSize

This value will alter the number of documents passed to the Elasticsearch bulk API endpoint when indexing, the default value is 500 but can be alterd via the following appSetting:

<appSettings>
 <add key="umbElasticsearch:AdditionalData:IndexBatchSize" value="1000" />
</appSettings>

You may wish to update this value based on various factors including:

  • the number of documents you are indexing
  • the size of the documents you are indexing

Refer to the Elasticsearch documentation for information on whether to tweak this value.

ExcludeFromIndexPropertyAlias

This value is the alias of an Umbraco boolean (True/False) property on the node being indexed, this property is checked to determine whether the node in question should be passed to the indexer or skipped. The default value for this alias is: umbElasticsearchExcludeFromIndex and can be updated as follows:

<appSettings>
 <add key="umbElasticsearch:AdditionalData:ExcludeFromIndexPropertyAlias" value="hideFromSearch" />
</appSettings>

EnableNodeLevelReIndex

This value is a boolean flag that defaults to false. When set to true will enable a right click context menu item that allows an individual content item to be re-indexed. This option will only appear for document types with a configured IndexService (either content or media)

<appSettings>
  <add key="umbElasticsearch:AdditionalData:EnableNodeLevelReIndex" value="true" />
</appSettings>

Overriding the configuration settings

It is possible to fully override and customise the configuration settings, however this is an advanced feature and will be described in a separate page. Using this technique you can customise where your configuration settings are stored, perhaps moving them into a database table, into cloud services or retrieved via remote API calls.