美文网首页Hadoop
elastic search 近实时性测试

elastic search 近实时性测试

作者: 良人与我 | 来源:发表于2019-05-09 18:35 被阅读57次

elastic search 版本 6.3.2

默认的 refresh_interval 是1s
spring里的document 配置 默认值也是 1s

@Persistent
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface Document {
    String indexName();

    String type() default "";

    boolean useServerConfiguration() default false;

    short shards() default 5;

    short replicas() default 1;

    String refreshInterval() default "1s";

    String indexStoreType() default "fs";

    boolean createIndex() default true;
}

下面开始我们的测试

创建了 index

POST /mytest/test/1
{ "title": "test" }

查看创建结果

GET /mytest/test/_search?pretty
{
  "query": {
    "match_all": {}
  }
}
// 执行结果
{
  "_index": "mytest",
  "_type": "test",
  "_id": "1",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 0,
  "_primary_term": 1
}

已经创建成功了。

配置分片刷新时间

为了看到效果 将时间设置为 20 s(默认应该是1s)

PUT /mytest/_settings
{
    "index" : {
        "refresh_interval" : "20s"
    }
}

查看配置

GET /mytest/_settings

{
  "mytest": {
    "settings": {
      "index": {
        "refresh_interval": "20s",
        "number_of_shards": "5",
        "provided_name": "mytest",
        "creation_date": "1557392988831",
        "number_of_replicas": "1",
        "uuid": "STiX7w_OQmu8OrR8jXTbzg",
        "version": {
          "created": "6030299"
        }
      }
    }
  }
}

更新数据

POST /mytest/test/1
{ "title": "how are you" }

然后再 查看数据,果真是之前的数据,一直查询,知道差不多过来20s ,数据更新了。

参考地址
https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-settings.html
https://doc.yonyoucloud.com/doc/mastering-elasticsearch/chapter-3/34_README.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.4/indices-update-settings.html

相关文章

网友评论

    本文标题:elastic search 近实时性测试

    本文链接:https://www.haomeiwen.com/subject/bycgoqtx.html