# 1.1.Window 环境

> 官方资料：[Install Elasticsearch on Windows](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/windows.html)

## Window 环境 ElasticSearch 5.x 安装

> 环境版本：window 7
>
> Elasticsearch版本：5.2
>
> 生产环境不推荐在Window系统上使用Elasticsearch

注意：Elasticsearch5.x至少需要java 8版本，我在安装5.2版本的Elasticsearch时，官方建议建议使用1.8.0\_121 JDK版本

### JDK 安装

**1、下载jdk并安装**

* [jdk下载地址](https://www.gitbook.com/book/xiaoxiami/elasticsearch/edit)
* Window 环境安装jdk 步骤下一步下一步即可.

2、 配置系统环境变量

* [window下配置环境变量教程 ](http://blog.csdn.net/mazhaojuan/article/details/7468639/)

### 安装Elasticsearch

1、下载和解压缩Elasticsearch5.2.0安装包 （[Elasticsearch5.2.0下载地址](https://www.elastic.co/downloads/past-releases/elasticsearch-5-2-0)）

2、 启动Elasticsearch

进入目录找到bat文件， `bin\elasticsearch.bat`，Elasticsearch本身特点之一就是开箱即用，如果是中小型应用，数据量少，操作不是很复杂，直接启动即可

> 如果启动出现了报错"Could not reserve enough space for 2097152KB object heap" ,查看
>
> [Windows下ElasticSearch安装中的问题解决](http://blog.csdn.net/wonderluoying/article/details/53363971)

3、检查ES是否启动成功

访问url：<http://localhost:9200/?pretty>

返回以下内容即为成功

```
{
  "name" : "7bJsCFK",   // node名称
  "cluster_name" : "elasticsearch", //集群名称（默认的集群名称就是elasticsearch）
  "cluster_uuid" : "KcwFnSj_SSarJ5Pb3f0Fkw",
  "version" : {
    "number" : "5.2.0",  //  5.2.0，elasticsearch版本号
    "build_hash" : "24e05b9",
    "build_date" : "2017-01-24T19:52:35.800Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.0"
  },
  "tagline" : "You Know, for Search"
}
```

### 安装Kibana

> 学习阶段可以下载一个Kibanna进行测试语句，因为Kibana带有一个控制台，使用界面方式，去操作elasticsearch

1、下载和解压缩Kibana 5.2.0 安装包 （[Kibana 5.2.0下载地址](https://www.elastic.co/downloads/past-releases/kibana-5-2-0)）

2、启动Kibana

进入目录找到bat文件， `bin\kibana.bat`,双击启动即可

访问url：[http://localhost:5601](http://localhost:9200/?pretty)

3、进入Dev Tools界面 运行命令测试: 检测集群健康状况

```
GET /_cat/health?v
```

```
epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1475247709 17:01:49  elasticsearch green           1         1      0   0    0    0        0             0                  -                100.0%
```


---

# 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://xiaoxiami.gitbook.io/elasticsearch/an-zhuang/window-huan-jing.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.
