# Elasticsearch Upgarde (Ubuntu)

This article provides detailed instructions for upgrading Elasticsearch to the latest stable version on an Ubuntu system using the APT package manager. It ensures a smooth upgrade while preserving the existing configuration and data.

### **Prerequisites**

* User performing the upgrade has **sudo (administrative) privileges**.
* Elasticsearch is already installed on the system.
* Credentials for the **elastic** user are available (if security is enabled).
* System has **internet connectivity** to fetch updated packages from the repository.

## **Upgrade Steps**

* **Check the Current Version**
  * Run the following command to verify the installed Elasticsearch version:

    ```bash
    curl -XGET -u elastic:<password> http://localhost:9200
    ```
  * Replace `<password>` with the actual password of the **elastic** user.

    <figure><img src="/files/hshLaWjLX0O3o8Nb5qiR" alt=""><figcaption></figcaption></figure>
* **Stop the Elasticsearch Service**
  * Prevent data corruption by stopping the service before upgrading:<br>

    ```bash
    sudo systemctl stop elasticsearch
    ```

    <figure><img src="/files/RPTj4BhpM3SsKsydihLC" alt=""><figcaption></figcaption></figure>
* **Upgrade Elasticsearch via APT**
  * Update repositories and install the latest version:

    ```bash
    sudo apt update
    sudo apt install elasticsearch -y
    ```

    <figure><img src="/files/eQ0RDlcdWmLBKm6lIPJC" alt=""><figcaption></figcaption></figure>
  * This fetches the latest version from the configured Elastic APT repository.
* **Start the Elasticsearch Service**
  * Restart the service after installation:

    ```bash
    sudo systemctl start elasticsearch
    ```
* **Verify the Upgrade**
  * Confirm the installed version:

    ```bash
    curl -XGET -u elastic:<password> http://localhost:9200
    ```
  * The response should show the **upgraded version number**.

## **Post-Upgrade Verification (Optional)**

* Check Elasticsearch logs for warnings or errors:

  ```bash
  sudo journalctl -u elasticsearch
  ```
* Confirm the updated version with the API:

  ```bash
  curl -XGET -u elastic:<password> http://localhost:9200
  ```

  <figure><img src="/files/C1L3WjfW5v1Io1t0rgCP" alt=""><figcaption></figcaption></figure>

***

Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ovaledge.com/deployment-and-maintenance/upgrade/elasticsearch-upgarde-ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
