Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Getting started with Elasticsearch in Ucommerce

Setting up Elasticsearch

By default, Ucommerce will connect to Elasticsearch on http://localhost:9200

The easiest way to run Elasticsearch locally is using powershell and Chocolatey:

    
    
    cinst elasticsearch -y
    Start-Service -Name "elasticsearch-service-x64"
    
    

Or download and install manually from the elastic website.

How to enable the Elasticsearch search provider for Ucommerce

1) Find the Ucommerce Apps dir. Rename the dir namedUcommerce.Search.Lucene under Ucommerce app directory to Ucommerce.Search.Lucene.disabled

1) Rename Ucommerce.Search.ElasticSearch.disabled to Ucommerce.Search.ElasticSearch

1) Reset IIS or recycle your app pool.

1) Head to Ucommerce -> Settings -> Search and hit _Index everything from scratch_.

Additional steps when upgrading from from a prior Ucommerce version:

1) When Ucommerce is upgraded, all the configuration for the Ucommerce apps is replaced. In order to make sure you preserve your custom configuration, it should live in a separate app e.g. Ucommerce.Search.Elasticsearch.Avenue right next to our Ucommerce.Search.Elasticsearch app.

OOTB connection (developer setup)

This section describes how Elastic is configured out-of-the-box when installing Ucommerce. This should help during development in case you need to make adjustments (eg. Elastic running on a different port.)

Note that the this implementation is meant only for developing and testing - and must be replaced by a production instance before go-live.

Changing just the connection string for dev setup can be done with a customer configuration file under the apps folder (alphabetically included after the elastic search folder to properly overwrite)

    
    
        <component id="ConnectionPool"
                         service="Elasticsearch.Net.SingleNodeConnectionPool, Elasticsearch.Net"
                         type="Ucommerce.Search.ElasticSearch.ConnectionPool, Ucommerce.Search.ElasticSearch">
                    <parameters>
                        <uri>http://localhost:9200/</uri>
                    </parameters>
              </component>
        
    

Production configuration

As mentioned above, the default implementation is only for testing and previewing. In order to take your shop online, you must configure the connection to your requirements. There are several types of ElasticSearch setups, but below you will find an example on how to configure a connection that will connect to a cloud instance.

Configuration The configuration is not too different from the previous example. The two high-level components don’t change from the previous example: SearchProvider and ConnectionSettings. The service of the ConnectionPool changed to Elasticsearch.Net.CloudConnectionPool and a new type is introduced for handling authentication credentials.

The following components should be changed to match your setup. Place them in a configuration file as mentioned before.

    
    
            <component id="ConnectionPool"
                       service="Elasticsearch.Net.CloudConnectionPool, Elasticsearch.Net"
                       type="Ucommerce.Search.ElasticSearch.ConnectionPool, Ucommerce.Search.ElasticSearch">
                <parameters>
                    <cloudId>cloudId</cloudId>
                    <BasicAuthenticationCredentials>${MyBasicAuthenticationCredentials}</BasicAuthenticationCredentials>
                </parameters>
            </component>
            
            <component id="MyBasicAuthenticationCredentials"
                       service="Elasticsearch.Net.BasicAuthenticationCredentials, Elasticsearch.Net"
                       type="Ucommerce.Search.ElasticSearch.MyBasicAuthenticationCredentials, Ucommerce.Search.ElasticSearch">
                <parameters>
                   <username>username</username>
                    <password>password</password>
                </parameters>
            </component>
    
    

Elastic cloud

For more info see:

https://www.elastic.co/cloud/

https://www.elastic.co/guide/en/cloud-enterprise/1.1/ece-provisioning.html

External Resources:

Connection pool options

Configuration options