Installing Elasticsearch on Windows

Table of Contents

To complete this installation, you will need a machine with either Windows Server 2016 or higher or Windows 10 (64-bit) installed. If you want to use a virtual machine on Azure, you can read how to create one.

KanBo does not yet support Elasticsearch version 9. The newest versions of Elasticsearch and Kibana are available at these links:
https://www.elastic.co/downloads/past-releases#elasticsearch
https://www.elastic.co/downloads/past-releases#kibana

Installation

1. Installing Elasticsearch and the Elastic Kibana component

  1. Access your Windows VM.
  2. Make sure you have the latest updates to use Edge, Chrome, or Firefox. Other browsers are not supported.
  3. (Optional) Download and install 7-Zip. The Kibana zip file contains a large number of files that take a long time to unpack using the default Windows application.
  4. Download the two components in the latest release:
  5. Move the .zip files to the folder where Elastic will be installed and extract them.
  6. Open the Command Prompt (cmd.exe).
  7. In Command Prompt, navigate to the folder where you extracted Elasticsearch, then go to the bin folder.

  1. Run elasticsearch.bat.

    Note that Elasticsearch configures the self-signed SSL certificate during installation, allowing it to use the HTTPS protocol.

  2. During installation, something like this should appear:

    Copy the contents of the CMD window to Notepad and save them for future use. This output contains the superuser password and the enrollment token that will be used to connect to Kibana.

  1. Do not close this command prompt yet, as it is running the Elasticsearch service. We will install Elasticsearch as a service after connecting Elasticsearch with KanBo.

2. Checking if Elasticsearch is running

Check if you can access Elasticsearch by opening the following URL in your VM's browser: https://localhost:9200. You will see an error about an invalid certificate, but don't worry about that for now, as we will fix it later.


3. Connecting Elasticsearch with Kibana

Kibana is the visual front end of Elasticsearch. For now, we will need Kibana to set up the search and configure a user account to connect KanBo to Elasticsearch.

  1. Open a new Command Prompt window (a second one) and go to the /bin folder of Kibana.

  1. Run kibana.bat.
  2. Next, the following message will appear:

  1. Open the URL shown in the Command Prompt using a browser on your VM.
  2. Paste the enrollment token from your Notepad inside the text field, and then select Configure Elastic.



4. Creating a User for KanBo

By now, you should have two Command Prompt windows open: one running Kibana and one running Elasticsearch. Do not close these windows during user configuration — you will need them later.

  1. Open Kibana in your browser by entering the URL from "Connecting Elasticsearch with Kibana," Step 3.
  2. Log in with the username "elastic" and the password of the Elasticsearch build-in superuser from "Installing Elasticsearch and the Elastic Kibana component."
  3. When this window appears, select Explore on my own.

  1. In the search bar at the top of the site, search for “Roles,” and then select Go to.

  1. Select Create role.

  1. In role name, type “admin-KanBoSearch”.

  1. Then configure these options the same way they are configured in the screenshot.

    Cluster privileges: manage , manage_security
    Run As privileges: *
    Indices: kanbosearch.*
    Privileges: all.
  2. After creating a role, search for “Users” in the top bar, and then select Go to.

  1. And create a user in this fashion:

It is a good idea to use the same username as the role name. You set the password, which is not generated.

  1. For the “roles” section, select the role created in the step before: “admin-KanBoSearch”.
  2. Save the username and password somewhere for later.


5. Running Elasticsearch as a service

  1. After configuring the user, we can safely stop the Kibana and Elasticsearch services running in our two open command line windows by pressing Ctrl+C in the Command Prompt windows. Note that Kibana must be stopped before Elasticsearch to avoid issues.
  2. Then, type Y and confirm with Enter.

  1. This should result in the Command Prompt windows looking like this:

After you stopped both batch jobs:

  1. In Command Prompt, go to Elasticsearch /bin folder and run elasticsearch-service.bat install.

You now have an Elasticsearch service.

To ensure that the Elasticsearch service runs every time the machine starts:

  1. Go to Services.

  1. Find the Elasticsearch service, right-click it, and select Properties.

  1. Select the automatic startup type.

  1. Apply the settings and start your Elasticsearch service.


6. Changing the Windows Service name

It is good practice to change the name of the Windows service to something more descriptive. To change the name of the Elasticsearch Windows service:

  1. Right-click on the Elasticsearch service, and then select Properties.

  1. Copy the Display name.

  1. Open a Command Prompt window and type the following command: sc config "COPIED SERVICE NAME" displayname="KanBo Elastic Search."
  2. Example: sc config "elasticsearch-service-x64" displayname= "KanBo Elastic Search"

  1. To change the description of the service, run the command: sc description "COPIED SERVICE NAME" "DESCRIPTION".
  2. Example: sc description "elasticsearch-service-x64" "Elasticsearch used in KanBo"

  1. Go back to Services, and select the refresh button.

Your service name and description have been updated.


7. Connecting KanBo with Elasticsearch

  1. Open your KanBo app’s appSettings.json file and add this code to the “Plugins” section.
{
    "type": "elastic",
    "tenant": "kanbosearch",
	"connection": {
		"url": "https://ELASTIC-URL:9200",
		"login": "admin-KanBoSearch",
		"password": "USER-PASSWORD"
	}
   }
  1. Replace ELASTIC-URL with the address of your Elasticsearch machine and USER-PASSWORD with the password you created for the admin KanBoSearch user. Be sure to include “https://” and “:9200” in the URL.
  2. After pasting the code, save the changes and restart the KanBo app. Restarting the app is required for KanBo to load the modified configuration.
  3. Go to KanBo Setup > Show advanced setup > Elastic.
  1. If the “Elastic” option does not appear, restart KanBo and try again.
  2. In the Data import section, select All, check the Clean box, and then select Execute.

Wait until Elastic has indexed everything.

Your KanBo uses Elasticsearch now.

To test the KanBo Search, go to KanBo, create a space, and a card inside of it. Then, go to KanBo Search, and search for the name of the card. 

Troubleshooting

Verification required in Kibana

You are configuring Kibana and this popup appears

That means you opened the address without the ?code=123456 part. To verify, you can type in the code from the URL present in the 3rd step of the Kibana connection process.

Failed registering elastic connection: Elastic ping failed

This error appears when any of the input in the “connection” section is incorrect (not just the URL), or if KanBo cannot connect to the specified IP address. Please, make sure that:

  1. The URL starts with "https://", the machine IP is correct, and it is followed by ":9200" at the end.
  2. The username and password are correct.
  3. The tenant name doesn’t include the “.*” part, that was present inside the Indices of a role we have created in Kibana.
  4. In case the Elasticsearch service is not hosted on the same machine as KanBo, make sure that this URL is accessible from the KanBo machine.

Open ports inside of the Machine

It is possible that the 9200 port is blocked by the firewall inside the VM. If you have a VM hosted on Azure, the port may not have been enabled in the VM's networking settings. Please refer to the article about preparing the VM on Azure. To open ports on a Windows VM:

  1. Go to Windows Defender Firewall > Advanced settings.

  1. Select Inbound Rules > New Rule.

  1. Select Port > Next > select TCP, and in Specific local ports enter “9200”.

  1. Allow the connection.

  1. Check every box, and select Next.

  1. Type in the name of the rule and select Finish.


Check if the user is configured properly in Kibana

  1. If stopped, start Kibana and log in.
  2. Go to Roles, and then select the role that you created.

  1. Make sure that the Cluster privileges, Run As privileges, Indices and Privileges are configured accordingly to the previous steps. Also make sure that indices end with “.*”.
  2. Go to Users, and then select the role that you created.
  3. Make sure that the correct role is assigned to this user.
  4. If you are unsure about the password, you can reset it by selecting Change password.


Connecting to Elasticsearch hosted on a Hyper-V virtual machine

If you decide to host your Elasticsearch virtual machine on Hyper-V, your host machine needs to reroute traffic from the machine's port to the VM's port.

  1. Open Routing and Remote Access.
  2. Double-click on Ethernet.

  1. Head to Services and Ports > Add....

  1. Add a description (e.g., "ElasticSearch"), and keep "On this interface" and the "TCP" protocol selected.
  2. In the "Incoming port" field, enter the port you want to use to connect to Elasticsearch hosted on your VM.
  3. In the "Private Address" field, enter the IP address of your VM.
  4. In the "Outgoing Port" field, enter 9200 (the port Elasticsearch uses).
  5. Select OK.

  1. Select Apply.

Now you should be able to connect to Elasticsearch hosted on your Hyper-V virtual machine.


Was this article helpful?

Please, contact us if you have any additional questions.