{
    "version": "8.12.0",
    "description": "Distributed, RESTful Search Engine",
    "homepage": "https://www.elastic.co/products/elasticsearch",
    "license": {
        "identifier": "Freeware|Apache-2.0",
        "url": "https://github.com/elastic/elasticsearch/blob/master/LICENSE.txt"
    },
    "architecture": {
        "64bit": {
            "url": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.12.0-windows-x86_64.zip",
            "hash": "sha512:4be7ffbca42280709ad1bae6148f5f5b2bd1961554f71a02ab48de19c9d1b9999e465d89970a023a2f5ddaa7615432b11c2b14a022bfa7ee4c46dc8e033099bd"
        }
    },
    "extract_dir": "elasticsearch-8.12.0",
    "pre_install": [
        "    # Overwrite SCRIPT because elasticsearch-env.bat doesn't care if SCRIPT or ES_HOME are already set ...",
        "$file = \"$dir\\bin\\elasticsearch-env.bat\"",
        "$cont = (Get-Content \"$file\") -replace 'set SCRIPT=%0', \"set SCRIPT=$file\"",
        "Set-Content \"$file\" ($cont -join \"`r`n\") -Encoding ASCII",
        "    # use persistent data/logs directory",
        "$file = \"$dir\\config\\elasticsearch.yml\"",
        "$cont = (Get-Content \"$file\") -replace '#path.data:.*$', \"path.data: $persist_dir\\data\"",
        "$cont = $cont -replace '#path.logs:.*$', \"path.logs: $persist_dir\\logs\"",
        "Set-Content \"$file\" ($cont -join \"`r`n\") -Encoding ASCII"
    ],
    "env_add_path": "bin",
    "persist": [
        "config",
        "plugins"
    ],
    "checkver": {
        "url": "https://www.elastic.co/downloads/elasticsearch",
        "regex": "elasticsearch-([\\d.]+)-windows"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$version-windows-x86_64.zip"
            }
        },
        "hash": {
            "url": "$url.sha512"
        },
        "extract_dir": "elasticsearch-$version"
    }
}
