Install Elasticsearch

After you have set up your P4 Server, you can install Elasticsearch. Elasticsearch is the engine used for indexing, searching, and analyzing data. To learn more, see About Elasticsearch.

You must have Elasticsearch installed to use P4 Search. P4 Search requires Elasticsearch 8.12.1 to 8.19.3.

Before you begin

  • You must have a P4 Server server running.

  • Provision sufficient disk space for your Perforce depot. Text and metadata are stored in Elasticsearch indexes.

  • Make sure you meet the hardware requirements for indexing your data. These will depend on both the quantity and the type of data you have. Text, 2D images, and 3D models are all handled differently in the back end. See Index throughput.

P4 DAM and P4 Search might support different versions of Elasticsearch. To learn more about supported services in P4 DAM, see the P4 DAM Administrator Guide.

Install Elasticsearch

  • The following installation steps are applicable to single-node or small site deployments only. To install multiple nodes, see Install Elasticsearch with Debian Package.

  • Elasticsearch must be installed on a clean computer running the Linux operating system. Ensure that any previous versions of Elasticsearch are removed.

To install Elasticsearch with a Debian package on a single node or in a small site deployment:

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

  2. Import the Elasticsearch Pretty Good Privacy (PGP) key. Follow the instructions in Import the Elasticsearch PGP Key.

  3. From the Advanced package tool (APT) repository, take the following actions:

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

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

      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

    The Elasticsearch password is displayed in your terminal.

  4. Add the Elasticsearch password to the P4 Search configuration file in etc/config.properties file. The user name is elastic.

    P4 Search automatically creates the required indexes.

  5. To configure Elasticsearch to start automatically when the system starts, run the following commands:

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

    To start or stop Elasticsearch manually, see Start or stop Elasticsearch.

    By default, the Elasticsearch service doesn’t log information in the systemd journal.

  6. (Optional) To enable journalctl logging, remove the --quiet option from the ExecStart command line in the /usr/lib/systemd/system/elasticsearch.service file.

    To view logging information in the systemd journal, see View logging information in the systemd journal.

  7. Verify that the Elasticsearch node is running by taking one of the following actions:

    • 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 installation instructions.

      If Elasticsearch is running, it sends a response similar to the following example:

      {
        "name" : "Cp8oag6",
        "cluster_name" : "elasticsearch",
        "cluster_uuid" : "AT69_T_DTp-1qgIJlatQqA",
        "version" : {
          "number" : "8.19.3",
          "build_type" : "tar",
          "build_hash" : "f27399d",
          "build_flavor" : "default",
          "build_date" : "2025-09-01T09:51:41.449Z",
          "build_snapshot" : false,
          "lucene_version" : "10.3.0",
          "minimum_wire_compatibility_version" : "1.2.3",
          "minimum_index_compatibility_version" : "1.2.3"
        },
        "tagline" : "You Know, for Search"
      }
    • In a web browser, navigate to the following URL:

      https://localhost:9200

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

  8. If you are configuring Elasticsearch for large sites, increase the Java Virtual Machine (JVM) memory. Use a custom options file to increase the JVM memory as described in Set JVM options.

  9. To allow P4 Search to work with a self-signed Elasticsearch, do not change the default setting in etc/config.properties file:

    com.perforce.p4search.elastic.insecure=true

  10. To add your Elasticsearch certificate to the JRE keystore, see Configure Elasticsearch.

You have successfully installed Elasticsearch. By default, the installation directory is /usr/share/elasticsearch.

The next step is to install the P4 Plugin Filter.

Start or stop Elasticsearch

You can start or stop Elasticsearch as follows:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

View logging information in the systemd journal

When systemd logging is enabled, you can access logging information by using the journalctl commands:

  • Tail the journal:

    sudo journalctl -f
  • Journal entries for the Elasticsearch service:

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

    sudo journalctl --unit elasticsearch --since  "2025-09-01 09:15:00"

For more command line options, run the man journalctl or see journalctl.

Enable logging

Elasticsearch recommends using the Log4j 2 configuration that is shipped by default.

To enable logging, see Elasticsearch logging.

Install the P4 Plugin Filter

The P4 Plugin Filter limits search results based on the protections table in P4 Server. To learn more, see Access Authorization in the P4 Server Administration Documentation.

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

    Follow the instructions for your OS distribution:

    To learn more about how to verify the authenticity of the signing key, see Perforce packages on the Perforce website.

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

    As root, follow the instructions for your OS distribution:

  3. Install the P4 Plugin Filter for your operating system:

    To learn more about Elasticsearch plugin installation and testing, see the Elasticsearch plugin documentation.

    Install the P4 Plugin Filter on Linux

    1. Import the Perforce package signing key and configure the Perforce package repository on the server hosting P4 Plugin Filter. See Install the P4 Plugin Filter.

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

      Follow the instructions for your OS distribution:

    Install the P4 Plugin Filter on Windows

    The P4 Plugin Filter is also known as the 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.19.3-2025.4.1234567.zip,
    4. where:

      • 8.19.3 is the Elasticsearch version supported
      • 2025.4 is the P4 Search version supported
      • 1234567 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.19.3-2025.4.1234567.zip

      • using the P4 Search endpoint, for example:
      • elasticsearch-plugin install http://<p4search host>:<p4search port>/api/v1.2/plugin/p4search-8.19.3-2025.4.1234567.zip

    6. Restart Elasticsearch after installing the plugin.

Optional Elasticsearch settings

The following are optional when setting up an Elasticsearch host for P4 Search:

  • By default, Elasticsearch is accessible only on localhost.

    To expose a specific node on the network, set network.host to a different address in the elasticsearch.yml file, as shown in the following example:

    network.host: 10.1.2.3

    where network.host specifies 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 shown in the following example:

    http.port: 9200

    where http.port specifies the port number of the Elasticsearch host.

    To learn more, see the Network module documentation.

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

    For example:

    discovery.seed_hosts: ["host1"]

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

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

    For example:

    cluster.initial_master_nodes: ["node-1"]

    To learn more, see the discovery and cluster formation module documentation on Discovery and cluster formation.

  • In your jvmoptions file, remove the xms and xmx settings. On Ubuntu, this file can be found in:

    /usr/share/elasticsearch/config/

To learn more about configuring Elasticsearch and the location of the config directory, see Configuring Elasticsearch.

Next steps

Related topics