---
title: "提高elasticsearch索引速度"
author: "maxrocray"
date: "2013-11-20T13:45:06Z"
tags: []
categories: ["开源软件"]
slug: "elasticsearch"
draft: false
lastmod: "2013-11-20T13:45:06Z"
id: 1977923
url: "https://maxrocray.iteye.com/blog/1977923"
---

提高索引性能和速度从几下方面着手：

 1. 增大索引实时时间设置：index.engine.robin.refresh\_interval :10s (默认为1s) 

 2. 增大内存缓冲区： indices.memory.index\_buffer\_size:20% (默认为heap大小的10%)

 3. 增加translog方面的设置： index.translog.flush\_threshold:10000 (默认为5000）

 4. 增加分配给ES的内存， 默认为1g.

 5. 减小replaca. 索引时可设置为0. 完成索引后再设置成想要的。 

 6. 增加机器数。

 7. index.merge.policy.use\_compound\_file 设置为false. 这样的话， 可以减少Merge （保证open file size 够 大）。