Install Elasticsearch

Important

To install Elasticsearch with a Debian package:

  1. Ensure that Elasticsearch is pinned and not upgraded. To pin an Elasticsearch version, follow the instructions for your OS distribution:

  2. Import the Elasticsearch PGP key. Download and install the public signing key as follows:

    wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
  3. Install from the Advanced package tool (APT) repository.

    1. Install the apt-transport-https package on Debian from the APT repository:

      sudo apt-get install apt-transport-https
    2. Save the repository definition to /etc/apt/sources.list.d/elastic.list:

      echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic.list
    3. Install the Elasticsearch Debian package.

      sudo apt-get update && sudo apt-get install elasticsearch
  4. When installing Elasticsearch, the Elasticsearch password is output to your terminal. Add the Elasticsearch password to the Helix Search configuration file in etc/config.properties. The user name is 'elastic'.

  5. Helix Search automatically creates the required indexes.

  6. To configure Elasticsearch to start automatically when the system boots up, run the following commands:

    sudo /bin/systemctl daemon-reload 
    sudo /bin/systemctl enable elasticsearch.service

    You can start or stop Elasticsearch as follows:

    sudo systemctl start elasticsearch.service
    sudo systemctl stop elasticsearch.service
  7. (Optional) By default the Elasticsearch service doesn’t log information in the systemd journal. To enable journalctl logging, the --quiet option must be removed from the ExecStart command line in the /usr/lib/systemd/system/elasticsearch.service file. When systemd logging is enabled, the logging information are available using the journalctl commands:

    • To tail the journal:

      sudo journalctl -f
    • To journal entries for the Elasticsearch service:

      sudo journalctl --unit elasticsearch
    • To journal entries for the Elasticsearch service from a specific start time:

      sudo journalctl --unit elasticsearch --since  "2016-10-30 18:17:16"

    For more command line options, execute man journalctl or see https://www.freedesktop.org/software/systemd/man/latest/journalctl.html.

  8. Check that Elasticsearch node is running by using either of the following ways:

    • Send an HTTPS request to port 9200 on localhost:

      curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic:$<ELASTIC_PASSWORD> https://localhost:9200 

      where, <ELASTIC_PASSWORD> is the password obtained in the Step 3 of these install instructions.

      Elasticsearch responds with:

      {
        "name" : "Cp8oag6",
        "cluster_name" : "elasticsearch",
        "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
        "version" : {
          "number" : "8.11.1",
          "build_type" : "tar",
          "build_hash" : "f27399d",
          "build_flavor" : "default",
          "build_date" : "2016-03-30T09:51:41.449Z",
          "build_snapshot" : false,
          "lucene_version" : "9.8.0",
          "minimum_wire_compatibility_version" : "1.2.3",
          "minimum_index_compatibility_version" : "1.2.3"
        },
        "tagline" : "You Know, for Search"
      }
    • To check if Elasticsearch is running from a web browser, navigate to https://localhost:9200.

  9. Elasticsearch loads its configuration from the /etc/elasticsearch/elasticsearch.yml file by default.

    If you are configuring Elasticsearch for large sites then increase the Java Virtual Machine (JVM) memory. Elasticsearch recommends using custom options file to increase the JVM memory. See https://www.elastic.co/guide/en/elasticsearch/reference/8.11/advanced-configuration.html#set-jvm-options.

  10. To allow Helix Search to work with a self-signed Elasticsearch, by default the following configurable in the etc/config.properties file is set to true.

    com.perforce.p4search.elastic.insecure=true

  11. To add your Elasticsearch certificate to the JRE keystore, see Configure self-signed certificate.

  12. The default Elasticsearch install directory is /usr/share/elasticsearch.

You have successfully installed Elasticsearch. The next step is to install the Helix Plugin Filter.

Tips for setting up an Elasticsearch host

Here are a few tips that are helpful when setting up an Elasticsearch host for Helix Search:

  • By default Elasticsearch is only accessible on localhost.

    Set network.host to a different address in elasticsearch.yml to expose a specific node on the network as follows:

    network.host: 10.1.2.3

    where, network.host is the IP address of the Elasticsearch server.

  • By default Elasticsearch listens for HTTP traffic on the first free port it finds starting at 9200.

    Set http.port to a specific HTTP port as per your requirement as follows:

    http.port: 9200

    where, http.port is the port number of the Elasticsearch host.

    For more information, see network module documentation on https://www.elastic.co/guide/index.html.

  • To perform discovery when a node is started, pass an initial list of hosts.

    For example:

    discovery.seed_hosts: ["host1"]

    The default list of hosts is ["127.0.0.1", "[::1]"]

  • To bootstrap the cluster using an initial set of master-eligible nodes.

    For example:

    cluster.initial_master_nodes: ["node-1"]

    For more information, see the discovery and cluster formation module documentation on https://www.elastic.co/guide/index.html.

For more information about configuring Elasticsearch and location of the config directory, see https://www.elastic.co/guide/en/elasticsearch/reference/8.11/settings.html.

Install the Helix Plugin Filter

  1. Import the Perforce package signing key, on the server hosting Helix Plugin Filter or Helix Search.

    Follow the instructions for your OS distribution:

    For information about how to verify the authenticity of the signing key, see: https://www.perforce.com/perforce-packages

  2. Configure the Perforce package repository on the server hosting Helix Plugin Filter or Helix Search.

    As root, follow the instructions for your OS distribution:

  3. There are two ways to install the Helix Plugin Filter:

    For information on Elasticsearch plugin installation and testing, see the elastic.co documentation.

    Manually install the Helix Plugin Filter

    To manually install the Helix Plugin Filter also known as Elasticsearch plugin p4search-filter:

    1. Remotely log in to the Elasticsearch host.
    2. Change directory so you are in the Elasticsearch installation directory, typically %ES_HOME%\bin.
    3. To install the plugin, look in the <p4search-installation>/lib directory for the exact filename. For example, p4search-filter-8.11.1-2023.5.2222222.zip.
    4. Where:

      • 8.11.1 is the Elasticsearch version supported
      • 2023.5 is the Helix Search version supported
      • 2222222 is the changelist number of the file

    5. Install the plugin either:
      • from a local file, for example:
      • elasticsearch-plugin install file:///path/to/plugin/p4search-filter-8.11.1-2023.5.2222222.zip

      • or using the Helix Search endpoint, for example:
      • elasticsearch-plugin install http://<p4search host>:<p4search port>/api/v1.2/plugin/p4search-8.11.1-2023.5.2222222.zip

    6. Restart Elasticsearch after installing the plugin.

    Install the Helix Plugin Filter from a Linux package

    To install the Helix Plugin Filter from a package:

    1. Import the Perforce package signing key and configure the Perforce package repository on the server hosting Helix Plugin Filter. To do this, see Prerequisites .

    2. Install the Helix Plugin Filter package on the server hosting Elasticsearch.

      Follow the instructions for your OS distribution: