[程序员] es 过亿数据查询咨询

前提: 1 亿左右的数据,数据来源是设备的轨迹数据(gps ,速度,温度等信息),设备端按 5s 左右一次上报 查询需求: 能支持查询 3 400 台设备的最新轨迹数据 查询单个设备的轨迹信息(这个简单) 我自己尝试搭建了 3 个节点的 es ,每个节点 4g 左右内存,发现执行需求 1 时,大概需...
[程序员] es 过亿数据查询咨询
[程序员] es 过亿数据查询咨询

1 亿左右的数据,数据来源是设备的轨迹数据(gps ,速度,温度等信息),设备端按 5s 左右一次上报

查询需求:
  1. 能支持查询 3 400 台设备的最新轨迹数据
  2. 查询单个设备的轨迹信息(这个简单)

我自己尝试搭建了 3 个节点的 es ,每个节点 4g 左右内存,发现执行需求 1 时,大概需要 2-5s 左右,查询语句:

curl -X GET "http://192.168.1.210:9200/test_index/_search?pretty" \
-H 'Content-Type: application/json' \
-d '{
  "query": {
    "terms": {
      "serialNumber": [省略 sn]
    }
  },
  "collapse": {
    "field": "serialNumber"
  },
  "size": 300
}'

mapping 信息:

{
  "settings": {
    "number_of_shards": 3,
    "number_of_replicas": 1,
    "index": {
      "sort.field": "createTime",
      "sort.order": "desc"
    }
  },
  "mappings": {
    "properties": {
      "serialNumber": {
        "type": "keyword"
      },
      "createTime": {
        "type": "date",
        "format": "strict_date_optional_time||epoch_millis||yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd HH:mm:ss"
      },
      "longitude": {
        "type": "double"
      },
      "latitude": {
        "type": "double"
      }
    }
  }
}

请问可以做到需求 1 查询 3-400 台设备,耗时到 1s 左右吗?

来源: v2ex查看原文