Skip to content

ElasticSearch

https://www.elastic.co/elasticsearch/

概述

使用Java编写,基于Lucene的: 搜索引擎框架

倒排索引

https://www.elastic.co/guide/en/elasticsearch/guide/current/inverted-index.htmlhttps://www.elastic.co/guide/cn/elasticsearch/guide/current/inverted-index.html

全文检索

在海量数据中执行搜索功能时,如果使用MySQL,效率太低。

高亮显示

将搜索关键字,以不同的样式展示

ElasticSearch的结构

索引,分片和备份

Index, 类似于MySQL中的

每一个索引默认被分成5片存储。

每一个分片都会存在至少一个备份分片。

备份分片默认不会帮助检索数据,当ES检索压力特别大的时候,备份分片才会帮助检索数据。

备份的分片必须放在不同的服务器中。

类型

Type,类似于MySQL中的ES 6.0或以前,一个Index可以有多个Type ES 6.x,一个Index只能有一个Type ES 7.x,取消了Type的概念

文档

Document,类似于MySQL中的记录

字段

Field,类似于MySQL中的字段

字段类型

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html

  • 字符串类型

    • text

      一般用于全文检索。 将Field分词。

    • keyword

      不会被分词。

  • 数值类型

    • long

      取值范围为-9223372036854774808~922337203685477480(-2的63次方到2的63次方-1),占用8个字节

    • integer

      取值范围为-2147483648~2147483647(-2的31次方到2的31次方-1),占用4个字节

    • short

      取值范围为-32768~32767(-2的15次方到2的15次方-1),占用2个字节

    • byte

      取值范围为-128~127(-2的7次方到2的7次方-1),占用1个字节

    • double

      1.797693e+308~ 4.9000000e-324 (e+308表示是乘以10的308次方,e-324表示乘以10的负324次方)占用8个字节

    • float

      3.402823e+38 ~ 1.401298e-45(e+38表示是乘以10的38次方,e-45表示乘以10的负45次方),占用4个字节

    • half_float

      精度比float小一半

    • scaled_float

      根据一个long和scaled来表达一个浮点型,long-345,scaled-100 -> 3.45

  • 时间类型

    • date

      针对时间类型指定具体的格式

  • 布尔类型

    • boolean

      表达true和false

  • 二进制类型

    • binary

      暂时支持Base64 encode string

  • 范围类型:

    赋值时,无需指定具体的内容,用于存储一个范围,可以指定gt,lt,gte,lte。

    • long_range

    • integer_range

    • double_range

    • float_range

    • date_range

    • ip_range

  • 经纬度类型

    • geo_point
  • ip 类型

    • ip

      可以存储IPV4或者IPV6

安装

启动容器

  • docker-compose.yml
yml
version: "3.9"
services:
  elasticsearch:
    image: elasticsearch:7.12.0
    restart: always
    container_name: elasticsearch
    ports:
      - 9200:9200
      - 9300:9300
    environment:
      - "discovery.type=single-node"
      - "bootstrap.memory_lock=true"
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    volumes:
      - ./download:/usr/share/elasticsearch/download
  kibana:
    image: kibana:7.12.9
    restart: always
    container_name: kibana
    ports:
      - 5601:5601
    environment:
      - elasticsearch_url=http://192.168.56.1:9200
    depends_on:
      - elasticsearch

networks:
  default:
    external: true
    name: global

安装ik分词器

在线安装

bash
bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.9.3/elasticsearch-analysis-ik-7.9.3.zip

离线安装

bash
bin/elasticsearch-plugin install file:///usr/share/elasticsearch/download/elasticsearch-analysis-ik-7.9.3.zip

重启容器

bash
docker-compose restart

基本操作

索引操作

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices.html

分词

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html

  • ik_smart

    粗粒度拆分

  • ik_max_word

    细粒度拆分

POST _analyze
{
  "analyzer": "ik_smart",
  "text":     "麒麟658处理器!柔光屏!华为新品全面上线,更多优惠猛戳"
}
POST _analyze
{
  "analyzer": "ik_max_word",
  "text":     "麒麟658处理器!柔光屏!华为新品全面上线,更多优惠猛戳"
}

创建索引

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html

创建空索引
PUT /person
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  }
}
  • number_of_shards

    分片数

  • number_of_replicas

    备份数

创建索引,同时定义字段
PUT /book
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "ik_max_word",
        "index": true ,
        "store": false 
      },
      "author": {
        "type": "keyword"
      },
      "count": {
        "type": "long"
      },
      "on-sale": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
      },
      "descr": {
        "type": "text",
        "analyzer": "ik_max_word"
      }
    }
  }
}
  • type

    指定类型

  • analyzer

    指定分词器

  • index

    是否参与索引

  • store

    是否持久化

  • format

    时间类型格式

删除索引

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-delete-index.html

DELETE /person

查看索引

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html

GET /person

GET /_cat/aliases

文档操作

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html

创建文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

自动生成_id
POST /book/_doc
{
  "name": "西游记",
  "author": "吴承恩",
  "count": 100000,
  "on-sale": "2000-01-01",
  "descr": "你挑着担,我牵着马"
}

POST /book/_doc
{
  "name": "红楼梦",
  "author": "曹雪芹",
  "count": 100000,
  "on-sale": "2000-01-01",
  "descr": "一个是阆苑仙葩,一个是美玉无瑕"
}
手动指定_id
POST /book/_doc/1
{
  "name": "三国演义",
  "author": "罗贯中",
  "count": 100000,
  "on-sale": "2000-01-01",
  "descr": "滚滚长江东浙水,浪花淘尽英雄"
}

POST /book/_doc/2
{
  "name": "水浒传",
  "author": "施耐庵",
  "count": 100000,
  "on-sale": "2000-01-01",
  "descr": "大河向东流,天上的星星参北斗"
}

查看文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html

GET /book/_doc/1

删除文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html

DELETE /book/_doc/1

根据检索删除文档

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html

数据准备

商品索引

PUT /product
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "id": {
        "type": "long"
      },
      "name": {
        "type": "text",
        "analyzer": "ik_max_word",
        "index": true,
        "store": false
      },
      "subTitle": {
        "type": "text",
        "analyzer": "ik_max_word",
        "index": true,
        "store": false
      },
      "brandId": {
        "type": "long"
      },
      "saleable": {
        "type": "boolean"
      },
      "createTime": {
        "type": "date"
      },
      "updateTime": {
        "type": "date"
      }
    }
  }
}
PUT /product/_bulk
{"index": {"_id": 2}}
{"id": 2, "name": "华为 G9 青春版 ", "subTitle": "骁龙芯片!3GB运行内存!索尼1300万摄像头!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": false, "createTime": "2018-04-21T15:55:15.000+00:00", "updateTime": "2018-06-18T10:36:12.000+00:00"}
{"index": {"_id": 3}}
{"id": 3, "name": "三星 Galaxy C5(SM-C5000)4GB+32GB ", "subTitle": "5.2英寸AMOLED屏,800+1600万像素,金属机身,小巧便捷,续航能力强大!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:55:18.000+00:00", "updateTime": "2018-04-21T15:55:18.000+00:00"}
{"index": {"_id": 4}}
{"id": 4, "name": "华为 麦芒5 全网通 4GB+64GB版 ", "subTitle": "光学防抖,持久续航!后置1600万像素,金属机身!<a href='http://item.jd.com/5148371.html?from_saf=1' target='_blank'>全面屏麦芒6低至2099元!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:20.000+00:00", "updateTime": "2018-04-21T15:55:20.000+00:00"}
{"index": {"_id": 5}}
{"id": 5, "name": "华为 HUAWEI nova 4GB+64GB版 ", "subTitle": "4K高清视频拍摄!美颜自拍!DTS音效!<a href='http://item.jd.com/5963064.html?from_saf=1' target='_blank'>nova2S白条3期免息!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:21.000+00:00", "updateTime": "2018-04-21T15:55:21.000+00:00"}
{"index": {"_id": 6}}
{"id": 6, "name": "魅族 PRO", "subTitle": "5.2英寸!500万+1200万像素!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:55:22.000+00:00", "updateTime": "2018-06-22T19:34:03.000+00:00"}
{"index": {"_id": 7}}
{"id": 7, "name": "华为 G9 Plus 32GB ", "subTitle": "高清大屏,长续航,骁龙芯片,表里不凡!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:23.000+00:00", "updateTime": "2018-04-21T15:55:23.000+00:00"}
{"index": {"_id": 8}}
{"id": 8, "name": "华为 畅享6 ", "subTitle": "轻薄有型,电力十足!5英寸AMOLED屏幕,4100mAh大容量电池!<a  target=\"_blank\"  href=\"https://sale.jd.com/act/DhKrOjXnFcGL.html\">华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:25.000+00:00", "updateTime": "2018-04-21T15:55:25.000+00:00"}
{"index": {"_id": 9}}
{"id": 9, "name": "华为 HUAWEI nova 青春版 4GB+64GB ", "subTitle": "双面弧面玻璃!麒麟658处理器!柔光屏!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:27.000+00:00", "updateTime": "2018-04-21T15:55:27.000+00:00"}
{"index": {"_id": 10}}
{"id": 10, "name": "魅族 魅蓝X 3GB+32GB 全网通公开版 ", "subTitle": "MTK P20芯片,5.5英寸全高清夏普屏!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:55:28.000+00:00", "updateTime": "2018-04-21T15:55:28.000+00:00"}
{"index": {"_id": 11}}
{"id": 11, "name": "OPPO A57 3GB+32GB内存版 ", "subTitle": "R15星空紫特别版今天10点开抢,货源稀缺,手慢无!此版本包含迪丽热巴微剧同款T恤、帽子,就要这样“紫”<a href='https://item.jd.com/7294559.html#crumb-wrap' target='_blank'>去看热巴同款</a>", "brandId": 2032, "saleable": true, "createTime": "2018-04-21T15:55:30.000+00:00", "updateTime": "2018-04-21T15:55:30.000+00:00"}
{"index": {"_id": 12}}
{"id": 12, "name": "华为 HUAWEI nova 2 4GB+64GB ", "subTitle": "前置2000万高清美拍,光学变焦双镜头!<a href='http://item.jd.com/5963064.html?from_saf=1' target='_blank'>nova2S白条3期免息!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:32.000+00:00", "updateTime": "2018-04-21T15:55:32.000+00:00"}
{"index": {"_id": 13}}
{"id": 13, "name": "华为畅享7 3GB+32GB ", "subTitle": "【限量领券立减100元】成交价899元!金属机身,骁龙芯片!<a href='http://item.jd.com/6001257.html?from_saf=1' target='_blank'>畅享7S成交价低至1399元!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:34.000+00:00", "updateTime": "2018-04-21T15:55:34.000+00:00"}
{"index": {"_id": 14}}
{"id": 14, "name": "华为 Mate 9 Pro 4GB+64GB版 ", "subTitle": "2K双曲面屏幕!二代徕卡双摄像头!<a href='http://item.jd.com/5706775.html?from_saf=1' target='_blank'>mate10 Pro购机享白条6期免息!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:35.000+00:00", "updateTime": "2018-04-21T15:55:35.000+00:00"}
{"index": {"_id": 15}}
{"id": 15, "name": "华为 畅享6S ", "subTitle": "骁龙芯片!金属机身!享看又享玩!<a  target=\"_blank\"  href=\"https://sale.jd.com/act/DhKrOjXnFcGL.html\">华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:37.000+00:00", "updateTime": "2018-04-21T15:55:37.000+00:00"}
{"index": {"_id": 16}}
{"id": 16, "name": "锤子 坚果Pro 128GB ", "subTitle": "1300万后置双摄像头/5.5英寸FHD显示屏/人脸识别/18W快充!<a href='https://sale.jd.com/act/T14MEWpIkheDcN.html' target='_blank'>坚果3火爆新品,点此下单</a>", "brandId": 91515, "saleable": true, "createTime": "2018-04-21T15:55:39.000+00:00", "updateTime": "2018-04-21T15:55:39.000+00:00"}
{"index": {"_id": 17}}
{"id": 17, "name": "华为 HUAWEI P10 Plus 6GB+", "subTitle": "【白条6期免息】wifi双天线设计!徕卡人像摄影!<a href='http://item.jd.com/3893493.html?from_saf=1' target='_blank'>P10徕卡双摄拍照,低至2988元!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:42.000+00:00", "updateTime": "2018-04-21T15:55:42.000+00:00"}
{"index": {"_id": 18}}
{"id": 18, "name": "华为 HUAWEI P10 全网通 4GB+64GB ", "subTitle": "【白条6期免息】wifi双天线设计!徕卡人像摄影!<a href='http://item.jd.com/4483120.html?from_saf=1' target='_blank'>大屏徕卡双摄P10 Plus,低至3388元!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:44.000+00:00", "updateTime": "2018-04-21T15:55:44.000+00:00"}
{"index": {"_id": 19}}
{"id": 19, "name": "魅族 魅蓝5s 全网通公开版 3GB+16GB ", "subTitle": "5.2英寸,CNC金属机身,18W快充!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:55:45.000+00:00", "updateTime": "2018-04-21T15:55:45.000+00:00"}
{"index": {"_id": 20}}
{"id": 20, "name": "小米 红米 4X 全网通版 ", "subTitle": "4100mAh 超长续航/骁龙处理器<a href='https://item.jd.com/6703337.html#crumb-wrap' target='_blank'>新版本红米5A,大内存更优惠!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:46.000+00:00", "updateTime": "2018-04-21T15:55:46.000+00:00"}
{"index": {"_id": 21}}
{"id": 21, "name": "小米5X 美颜双摄拍照手机 4GB+64GB ", "subTitle": "光学变焦双摄,拍人更美/5.5吋大屏轻薄全金属/骁龙八核处理器/4GB大内存<a href='https://mi.jd.com/' target='_blank'>点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:48.000+00:00", "updateTime": "2018-04-21T15:55:48.000+00:00"}
{"index": {"_id": 22}}
{"id": 22, "name": "小米 红米 4A 移动合约版 2GB内存 16GB ROM ", "subTitle": "3120mAh 大电池/1300万像素相机<a href='https://item.jd.com/6703337.html#crumb-wrap' target='_blank'>红米4A迭代新机红米5A,大内存更优惠!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:50.000+00:00", "updateTime": "2018-04-21T15:55:50.000+00:00"}
{"index": {"_id": 23}}
{"id": 23, "name": "华为畅享7 ", "subTitle": "【限量领券立减100元】成交价1399元!4000毫安续航大电池!<a href='http://item.jd.com/6001257.html?from_saf=1' target='_blank'>畅享7S成交价低至1399元!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:53.000+00:00", "updateTime": "2018-04-21T15:55:53.000+00:00"}
{"index": {"_id": 24}}
{"id": 24, "name": "荣耀 畅玩6 2GB+16GB ", "subTitle": "柔光自拍,舒适握感,长续航!<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:55:54.000+00:00", "updateTime": "2018-04-21T15:55:54.000+00:00"}
{"index": {"_id": 25}}
{"id": 25, "name": "小米Note3 美颜双摄拍照手机 6GB+64GB ", "subTitle": "1600万美颜自拍/2倍变焦双摄,四轴光学防抖/5.5吋护眼屏/超轻四曲面,7系铝金属边框<a href='https://mi.jd.com/' target='_blank'>点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:55.000+00:00", "updateTime": "2018-04-21T15:55:55.000+00:00"}
{"index": {"_id": 26}}
{"id": 26, "name": "小米MIX2 全面屏游戏手机 ", "subTitle": "全面屏2.0,5.99吋大屏/骁龙835旗舰处理器/4轴光学防抖/6模43频,全球频段<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:56.000+00:00", "updateTime": "2018-04-21T15:55:56.000+00:00"}
{"index": {"_id": 27}}
{"id": 27, "name": "小米Max2 大屏手机 4GB+64GB ", "subTitle": "6.44’’大屏/5300mAh 充电宝级的大电量/大像素相机/轻薄全金属<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:55:59.000+00:00", "updateTime": "2018-04-21T15:55:59.000+00:00"}
{"index": {"_id": 28}}
{"id": 28, "name": "小米6 全网通 4GB+64GB 亮", "subTitle": "骁龙835 旗舰处理器/变焦双摄,4 轴防抖/5.15吋 护眼屏/四曲面玻璃机身<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:00.000+00:00", "updateTime": "2018-04-21T15:56:00.000+00:00"}
{"index": {"_id": 29}}
{"id": 29, "name": "荣耀9 全网通 ", "subTitle": "领券立减200!成交价2599!2000万变焦双摄,3D曲面极光玻璃!<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:02.000+00:00", "updateTime": "2018-04-21T15:56:02.000+00:00"}
{"index": {"_id": 30}}
{"id": 30, "name": "小米 红米Note5A 全网通版 2GB+16GB ", "subTitle": "5.5吋高清大屏,高通骁龙处理器,超长续航,2+1卡槽<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:03.000+00:00", "updateTime": "2018-04-21T15:56:03.000+00:00"}
{"index": {"_id": 31}}
{"id": 31, "name": "华为 HUAWEI Mate 10 6GB+128GB ", "subTitle": "爆款直降,全民疯抢!麒麟970芯片!AI智能拍照!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为P20新品抢购,摄影大师,专门为你》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:05.000+00:00", "updateTime": "2018-04-21T15:56:05.000+00:00"}
{"index": {"_id": 32}}
{"id": 32, "name": "荣耀 畅玩7X 4GB+32GB 全网通4G全面屏手机 标配版 ", "subTitle": "限时优惠50!成交价1249!1600万高清双摄,全面屏手机~<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:06.000+00:00", "updateTime": "2018-04-21T15:56:06.000+00:00"}
{"index": {"_id": 33}}
{"id": 33, "name": "华为 HUAWEI Mate 10 Pro 全网通 6GB+128GB ", "subTitle": "爆款直降,全民疯抢!6英寸OLED全面屏!四曲面机身!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为P20新品抢购,摄影大师,专门为你》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:09.000+00:00", "updateTime": "2018-04-21T15:56:09.000+00:00"}
{"index": {"_id": 34}}
{"id": 34, "name": "小米 红米5 Plus 全面屏手机 全网通版 3GB+32GB ", "subTitle": "全面屏/4000mAh大电量/前置柔光自拍/14nm骁龙八核处理器<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:10.000+00:00", "updateTime": "2018-04-21T15:56:10.000+00:00"}
{"index": {"_id": 35}}
{"id": 35, "name": "小米 红米5", "subTitle": "搭载高通骁龙处理器,后置12MP旗舰相机,前置柔光自拍,配备5.7英寸全面屏。<a  target=\"_blank\"  href=\"https://mi.jd.com/\">点击了解更多小米手机!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:12.000+00:00", "updateTime": "2018-04-21T15:56:12.000+00:00"}
{"index": {"_id": 36}}
{"id": 36, "name": "荣耀 V10 高配版 6GB+64GB ", "subTitle": "麒麟970!全面屏!2000万AI变焦双摄!<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:14.000+00:00", "updateTime": "2018-04-21T15:56:14.000+00:00"}
{"index": {"_id": 37}}
{"id": 37, "name": "荣耀9青春版 全网通 标配版 3GB+32GB ", "subTitle": "限时赠耳机,赠完即止!全屏四摄,正反都美!<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:18.000+00:00", "updateTime": "2018-04-21T15:56:18.000+00:00"}
{"index": {"_id": 38}}
{"id": 38, "name": "荣耀畅玩7C 全面屏手机 全网通标配版 3GB+32GB ", "subTitle": "人脸识别,双摄美拍!<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀爆品钜惠,选品质,购荣耀~</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:19.000+00:00", "updateTime": "2018-04-21T15:56:19.000+00:00"}
{"index": {"_id": 39}}
{"id": 39, "name": "三星 Galaxy S9+(SM-G9650/DS)6GB+128GB ", "subTitle": "【下单送无线快充!白条12期免息,Plus会员下单送14000京豆】960帧/秒凝时拍摄,Bixby智能人工助手!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>F1.5-2.4智能可变光圈详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:56:21.000+00:00", "updateTime": "2018-04-21T15:56:21.000+00:00"}
{"index": {"_id": 40}}
{"id": 40, "name": "小米 红米Note4X 全网通版 ", "subTitle": "", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:23.000+00:00", "updateTime": "2018-04-21T15:56:23.000+00:00"}
{"index": {"_id": 41}}
{"id": 41, "name": "小米 红米5A 全网通版 3GB+32GB ", "subTitle": "8天长待机,金属机身,MIUI9快如闪电<a href='https://item.jd.com/5901119.html#crumb-wrap' target='_blank'>4G+全网通低至569</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:25.000+00:00", "updateTime": "2018-04-21T15:56:25.000+00:00"}
{"index": {"_id": 42}}
{"id": 42, "name": "vivo X21 全面屏 双摄美颜拍照手机 6GB+128GB ", "subTitle": "【3期免息,购机送好礼】大内存,大智慧,19:9新一代全面屏手机!AI智慧拍照!照亮你的美!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T15:56:26.000+00:00", "updateTime": "2018-04-21T15:56:26.000+00:00"}
{"index": {"_id": 43}}
{"id": 43, "name": "OPPO R15 全面屏双摄拍照手机 6G+128G ", "subTitle": "R15星空紫特别版今天10点开抢,货源稀缺,手慢无!此版本包含迪丽热巴微剧同款T恤、帽子,就要这样“紫”<a href='https://item.jd.com/7294559.html#crumb-wrap' target='_blank'>去看热巴同款</a>", "brandId": 2032, "saleable": true, "createTime": "2018-04-21T15:56:27.000+00:00", "updateTime": "2018-04-21T15:56:27.000+00:00"}
{"index": {"_id": 44}}
{"id": 44, "name": "华为 HUAWEI P20 AI智慧全面屏 6GB +64GB ", "subTitle": "AI摄影大师/DxO评分过百/一秒记忆960个定格/影棚级人像自拍<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品季,更多优惠猛戳》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:29.000+00:00", "updateTime": "2018-04-21T15:56:29.000+00:00"}
{"index": {"_id": 45}}
{"id": 45, "name": "华为畅享8 Plus 高清四摄大电池 4G+64G ", "subTitle": "前后双摄!4000mAh大电池!三卡槽扩容无忧!人脸识别,轻松解锁!<a  target=\"_blank\"  href=\"https://sale.jd.com/act/DhKrOjXnFcGL.html\">华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:31.000+00:00", "updateTime": "2018-04-21T15:56:31.000+00:00"}
{"index": {"_id": 46}}
{"id": 46, "name": "锤子(smartisan) 坚果 3 4G+64GB ", "subTitle": "三面窄边框全面屏、金属中框、Smartisan OS智能体验系统、彩色+黑白双核!<a href='https://sale.jd.com/act/T14MEWpIkheDcN.html' target='_blank'>更多详情请点击</a>", "brandId": 91515, "saleable": true, "createTime": "2018-04-21T15:56:32.000+00:00", "updateTime": "2018-04-21T15:56:32.000+00:00"}
{"index": {"_id": 47}}
{"id": 47, "name": "荣耀畅玩7A 全面屏手机 全网通标配版 2GB+32GB ", "subTitle": "限时赠耳机,赠完即止!全屏刷脸,与声俱来,2GB+32GB,骁龙430<a href='http://sale.jd.com/act/L1Y2V6ERZePab4.html' target='_blank'>荣耀10 99元定金预售,点击进入》》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:33.000+00:00", "updateTime": "2018-04-21T15:56:33.000+00:00"}
{"index": {"_id": 48}}
{"id": 48, "name": "小米(MI) 小米4A 红米4A 4G手机 ", "subTitle": "<a href=\"https://item.jd.com/18787246601.html\" target=\"_blank\">【红米note5限时抢购】</a>流畅打王者,信号稳定,通话清晰,5.0英寸屏,学生机。", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:35.000+00:00", "updateTime": "2018-04-21T15:56:35.000+00:00"}
{"index": {"_id": 49}}
{"id": 49, "name": "小米(MI) 小米4A 红米4A 4G手机 ", "subTitle": "1300万像素!3120mAh大电池!<a href=\"https://item.jd.com/11789883614.html\" target=\"_blank\">红米5A新品现货发售</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:56:36.000+00:00", "updateTime": "2018-04-21T15:56:36.000+00:00"}
{"index": {"_id": 50}}
{"id": 50, "name": "三星 Galaxy S8(SM-G9500)4GB+64GB ", "subTitle": "【送无线充电器!白条12期免息!】Plus会员送10000京豆!骁龙835芯片!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:56:41.000+00:00", "updateTime": "2018-04-21T15:56:41.000+00:00"}
{"index": {"_id": 51}}
{"id": 51, "name": "魅族 魅蓝 Note6 3GB+32GB 全网通公开版 ", "subTitle": "【下单立减80元】,高通八核CPU,4000mAh快充电池!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:56:44.000+00:00", "updateTime": "2018-04-21T15:56:44.000+00:00"}
{"index": {"_id": 52}}
{"id": 52, "name": "三星 Galaxy C8(SM-C7100)4GB+64GB ", "subTitle": "5.5英寸,后置双摄像头,面部识别+指纹识别!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:56:45.000+00:00", "updateTime": "2018-04-21T15:56:45.000+00:00"}
{"index": {"_id": 53}}
{"id": 53, "name": "三星 Galaxy S8+(SM-G9550)4GB+64GB ", "subTitle": "【送无线充电器!白条12期免息!】Plus会员送11000京豆!骁龙835芯片!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:56:47.000+00:00", "updateTime": "2018-04-21T15:56:47.000+00:00"}
{"index": {"_id": 54}}
{"id": 54, "name": "Meitu 美图T8s", "subTitle": "爆品直降,白条6期免息!<a href='https://sale.jd.com/act/YBVND8idyzEl.html' target='_blank'>更多美图精彩活动,戳</a>", "brandId": 38126, "saleable": true, "createTime": "2018-04-21T15:56:49.000+00:00", "updateTime": "2018-04-21T15:56:49.000+00:00"}
{"index": {"_id": 55}}
{"id": 55, "name": "华为 HUAWEI 麦芒 6 全网通 4GB+64GB版 ", "subTitle": "5.9英寸全面屏!出彩四镜头!支持NFC!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:56:51.000+00:00", "updateTime": "2018-04-21T15:56:51.000+00:00"}
{"index": {"_id": 56}}
{"id": 56, "name": "魅族 魅蓝 6 全网通公开版 2GB+16GB ", "subTitle": "秒杀降至599!快速解锁,忠于体验!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:56:52.000+00:00", "updateTime": "2018-04-21T15:56:52.000+00:00"}
{"index": {"_id": 57}}
{"id": 57, "name": "360手机 F", "subTitle": "2G+16G内存/5英寸屏幕/2.5D弧形玻璃/前置指纹识别<a href='http://sale.jd.com/act/lhyRYJDSTC.html' target='_blank'>360手机春季惠场,爆品领券立减100>></a>", "brandId": 27306, "saleable": true, "createTime": "2018-04-21T15:56:53.000+00:00", "updateTime": "2018-04-21T15:56:53.000+00:00"}
{"index": {"_id": 58}}
{"id": 58, "name": "360手机 N6 Pro 全网通 6GB+64GB ", "subTitle": "4050mAh大电池/1600万后置双摄/全面屏/骁龙660<a href='http://sale.jd.com/act/lhyRYJDSTC.html' target='_blank'>360手机春季惠场,爆品领券立减100>></a>", "brandId": 27306, "saleable": true, "createTime": "2018-04-21T15:56:55.000+00:00", "updateTime": "2018-04-21T15:56:55.000+00:00"}
{"index": {"_id": 59}}
{"id": 59, "name": "华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB ", "subTitle": "【限量领券减100】成交价1599!5.65英寸全面屏,后置双摄!<a href='https://item.jd.com/7029523.html#crumb-wrap' target='_blank'>华为新品季,畅享8e正式开卖》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:00.000+00:00", "updateTime": "2018-04-21T15:57:00.000+00:00"}
{"index": {"_id": 60}}
{"id": 60, "name": "三星 Galaxy S9+(SM-G9650/DS)6GB+64GB ", "subTitle": "【下单送无线快充!白条12期免息,Plus会员下单送13400京豆】960帧/秒凝时拍摄,Bixby智能人工助手!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>F1.5-2.4智能可变光圈详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:57:01.000+00:00", "updateTime": "2018-04-21T15:57:01.000+00:00"}
{"index": {"_id": 61}}
{"id": 61, "name": "三星 Galaxy S9+(SM-G9650/DS)6GB+256GB ", "subTitle": "【下单送无线快充!白条12期免息!Plus会员送14000京豆!】960帧/秒凝时拍摄,Bixby智能人工助手!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>F1.5-2.4智能可变光圈详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:57:02.000+00:00", "updateTime": "2018-04-21T15:57:02.000+00:00"}
{"index": {"_id": 62}}
{"id": 62, "name": "OPPO R15 梦镜版 全面屏双摄拍照手机 6G+128G ", "subTitle": "R15星空紫特别版今天10点开抢,货源稀缺,手慢无!此版本包含迪丽热巴微剧同款T恤、帽子,就要这样“紫”<a href='https://item.jd.com/7294559.html#crumb-wrap' target='_blank'>去看热巴同款</a>", "brandId": 2032, "saleable": true, "createTime": "2018-04-21T15:57:03.000+00:00", "updateTime": "2018-04-21T15:57:03.000+00:00"}
{"index": {"_id": 63}}
{"id": 63, "name": "vivo Y69 全网通 美颜拍照手机 3GB+32GB ", "subTitle": "【超高性价比】前置1600万柔光自拍!照亮你的美!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T15:57:04.000+00:00", "updateTime": "2018-04-21T15:57:04.000+00:00"}
{"index": {"_id": 64}}
{"id": 64, "name": "三星 Galaxy S9(SM-G9600/DS)4GB+128GB ", "subTitle": "【下单送无线快充!白条12期免息,Plus会员下单送12200京豆】960帧/秒凝时拍摄,Bixby智能人工助手!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:57:07.000+00:00", "updateTime": "2018-04-21T15:57:07.000+00:00"}
{"index": {"_id": 65}}
{"id": 65, "name": "华为畅享8 全面屏三卡槽 4GB+64GB ", "subTitle": "购机送重低音耳机!5.99英寸全面屏!三卡槽扩容无忧!人脸识别,轻松解锁!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:09.000+00:00", "updateTime": "2018-04-21T15:57:09.000+00:00"}
{"index": {"_id": 66}}
{"id": 66, "name": "vivo Y85 全面屏 美颜拍照手机 4GB+64GB ", "subTitle": "【3期免息,购机送好礼】19:9比例的全新全面屏,4GB运存,指纹面部双解锁,6.26英寸大屏,AI智慧美颜,AR萌拍 !<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T15:57:11.000+00:00", "updateTime": "2018-04-21T15:57:11.000+00:00"}
{"index": {"_id": 67}}
{"id": 67, "name": "【移动专享版】华为 HUAWEI P20 AI智慧全面屏 6GB+64GB ", "subTitle": "AI摄影大师!一秒记忆960个定格!影棚级人像自拍!", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:12.000+00:00", "updateTime": "2018-04-21T15:57:12.000+00:00"}
{"index": {"_id": 68}}
{"id": 68, "name": "华为畅享8e 全面屏后置双摄 3G+32G ", "subTitle": "5.7英寸全面屏!三卡槽扩容无忧!人脸识别,轻松解锁!<a href='https://sale.jd.com/act/DhKrOjXnFcGL.html' target='_blank'>华为新品全面上线,更多优惠猛戳》》</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:15.000+00:00", "updateTime": "2018-04-21T15:57:15.000+00:00"}
{"index": {"_id": 69}}
{"id": 69, "name": "华为(HUAWEI) 华为P20pro 手机 ", "subTitle": "华为直供货源大量现货!【宝石蓝128G及极光色全系为预售请见详情】自带原装耳机 <a href=\"https://item.jd.com/26816294484.html\" target=\"_blank\">华为P20</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:17.000+00:00", "updateTime": "2018-04-21T15:57:17.000+00:00"}
{"index": {"_id": 70}}
{"id": 70, "name": "华为(HUAWEI) 荣耀8 青春版 手机 ", "subTitle": "【2万+评价,正品行货】双面2.5D玻璃,我的颜值小担当<a href=\"https://item.jd.com/15936538487.html\" target=\"_blank\">【全屏四摄→荣耀9青春版】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:19.000+00:00", "updateTime": "2018-04-21T15:57:19.000+00:00"}
{"index": {"_id": 71}}
{"id": 71, "name": "小米(MI) 小米4A 红米4A 手机 ", "subTitle": "5英寸大屏,3120mAh电池!<a href=\"https://item.jd.com/21759433312.html\" target=\"_blank\">全新骁龙636,AI双摄,逆光暗光更出色-红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:57:22.000+00:00", "updateTime": "2018-04-21T15:57:22.000+00:00"}
{"index": {"_id": 72}}
{"id": 72, "name": "华为(HUAWEI) 华为 畅享6S 移动联通电信 智能老人手机 双卡双待 ", "subTitle": "内置带原装保护壳 再送保护膜【自营物流 货票同行】骁龙八核32G大内存 <a href=\"https://item.jd.com/26152373867.html\" target=\"_blank\">新品荣耀7C全面屏</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:25.000+00:00", "updateTime": "2018-04-21T15:57:25.000+00:00"}
{"index": {"_id": 73}}
{"id": 73, "name": "华为(HUAWEI) 荣耀7C 畅玩7C 全面屏手机 ", "subTitle": "【全部版本现货速发!】人脸识别,双摄美拍~<a href=\"https://item.jd.com/22071534211.html\" target=\"_blank\">荣耀7X</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:28.000+00:00", "updateTime": "2018-04-21T15:57:28.000+00:00"}
{"index": {"_id": 74}}
{"id": 74, "name": "华为(HUAWEI) 荣耀 畅玩6 全网通 移动联通电信4G 智能老人手机 双卡双待 ", "subTitle": "送双重好礼=壳+膜  京东直发【内置老人桌面 适合爸妈使用】<a href=\"https://item.jd.com/26152373868.html\" target=\"_blank\">新版荣耀7C人脸识别全面屏发售</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:29.000+00:00", "updateTime": "2018-04-21T15:57:29.000+00:00"}
{"index": {"_id": 75}}
{"id": 75, "name": "华为(HUAWEI) 华为nova3e 手机 ", "subTitle": "【现货热销】前置2400万自然美妆!<a href=\"https://item.jd.com/25390983397.html\" target=\"_blank\">【华为新品P20】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:31.000+00:00", "updateTime": "2018-04-21T15:57:31.000+00:00"}
{"index": {"_id": 76}}
{"id": 76, "name": "华为(HUAWEI) 荣耀V9Play手机 ", "subTitle": "【本商品正在参加春季大促活动】活动期间低至899!<a href=\"https://item.jd.com/25906780694.html\" target=\"_blank\">新品荣耀7C仅售899元起!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:33.000+00:00", "updateTime": "2018-04-21T15:57:33.000+00:00"}
{"index": {"_id": 77}}
{"id": 77, "name": "华为(HUAWEI) nova3e 全面屏手机 ", "subTitle": "送原装自拍杆+补光灯+壳膜扣套装!手机自带原装耳机!<a href=\"http://item.jd.com/21678745124.html\" target=\"_blank\">nova2s</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:39.000+00:00", "updateTime": "2018-04-21T15:57:39.000+00:00"}
{"index": {"_id": 78}}
{"id": 78, "name": "华为(HUAWEI) 华为 nova 3E 全面屏手机 ", "subTitle": "现货速发!前置2400万,后置1600万双摄!自带原装耳机保护套。新品<a href=\"https://item.jd.com/26881279032.html\" target=\"_blank\">P20pro</a>极光色", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:42.000+00:00", "updateTime": "2018-04-21T15:57:42.000+00:00"}
{"index": {"_id": 79}}
{"id": 79, "name": "华为(HUAWEI) 荣耀7C 畅玩7C 手机 ", "subTitle": "荣耀新品现货  送实用好礼 人脸识别,双摄美拍,5.99英寸全面屏  <a href=\"https://item.jd.com/24949343810.html\" target=\"_blank\">荣耀7X</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:44.000+00:00", "updateTime": "2018-04-21T15:57:44.000+00:00"}
{"index": {"_id": 80}}
{"id": 80, "name": "华为(HUAWEI) 荣耀8青春版 手机 ", "subTitle": "【尊享版4+64G低至1199元】双面2.5D玻璃,美品潮搭,颜值小担当~ <a href=\"https://item.jd.com/13114316683.html\" target=\"_blank\">荣耀9 戳我</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:47.000+00:00", "updateTime": "2018-04-21T15:57:47.000+00:00"}
{"index": {"_id": 81}}
{"id": 81, "name": "华为(HUAWEI) nova 智能手机 4G手机 ", "subTitle": "支持京东配送到付 送实用好礼 今日下单默认送延保一年 ,美颜自拍!<a href=\"https://item.jd.com/26509792446.html\" target=\"_blank\">华为nova3E热卖中</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:57:48.000+00:00", "updateTime": "2018-04-21T15:57:48.000+00:00"}
{"index": {"_id": 82}}
{"id": 82, "name": "三星 Galaxy S8+(SM-G9550)6GB+128GB ", "subTitle": "【送无线充电器!白条12期免息!】Plus会员送12600京豆!骁龙835芯片!<a href='https://sale.jd.com/act/T15MnRgiasWe8L.html' target='_blank'>三星S9震撼上市详情猛戳>></a>", "brandId": 15127, "saleable": true, "createTime": "2018-04-21T15:57:53.000+00:00", "updateTime": "2018-04-21T15:57:53.000+00:00"}
{"index": {"_id": 83}}
{"id": 83, "name": "Meitu 美图V6(MP1605)6GB+128GB ", "subTitle": "白条3期免息!<a href='https://sale.jd.com/act/YBVND8idyzEl.html' target='_blank'>更多美图精彩活动,戳</a>", "brandId": 38126, "saleable": true, "createTime": "2018-04-21T15:57:56.000+00:00", "updateTime": "2018-04-21T15:57:56.000+00:00"}
{"index": {"_id": 84}}
{"id": 84, "name": "锤子 坚果 Pro 2 ", "subTitle": "全面屏/骁龙660/人脸识别/后置双摄/精致美颜/18W快充!<a href='https://sale.jd.com/act/T14MEWpIkheDcN.html' target='_blank'>坚果3火爆新品,点此下单</a>", "brandId": 91515, "saleable": true, "createTime": "2018-04-21T15:57:58.000+00:00", "updateTime": "2018-04-21T15:57:58.000+00:00"}
{"index": {"_id": 85}}
{"id": 85, "name": "360手机 N6 Lite 全网通 4GB+32GB ", "subTitle": "4020mAh大电池/1300万摄像头/5.5英寸全高清屏幕/骁龙630<a href='http://sale.jd.com/act/lhyRYJDSTC.html' target='_blank'>360手机春季惠场,爆品领券立减100>></a>", "brandId": 27306, "saleable": true, "createTime": "2018-04-21T15:57:59.000+00:00", "updateTime": "2018-04-21T15:57:59.000+00:00"}
{"index": {"_id": 86}}
{"id": 86, "name": "360手机 N6 全网通 6GB+64GB ", "subTitle": "5030mAh大电池/18W快充/全面屏/骁龙630<a href='http://sale.jd.com/act/lhyRYJDSTC.html' target='_blank'>360手机春季惠场,爆品领券立减100>></a>", "brandId": 27306, "saleable": true, "createTime": "2018-04-21T15:58:00.000+00:00", "updateTime": "2018-04-21T15:58:00.000+00:00"}
{"index": {"_id": 87}}
{"id": 87, "name": "魅族 魅蓝 S6 全面屏手机 全网通公开版 3GB+64GB ", "subTitle": "下单立减60!三星7872六核处理器,侧面指纹,全面屏!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:58:02.000+00:00", "updateTime": "2018-04-21T15:58:02.000+00:00"}
{"index": {"_id": 88}}
{"id": 88, "name": "华为(HUAWEI) nova 手机 ", "subTitle": "【送好礼,现货速发,京东配送 】4K高清视频拍摄!美颜自拍!<a href=\"https://item.jd.com/10535883236.html\" target=\"_blank\">华为nova2S热销中</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:04.000+00:00", "updateTime": "2018-04-21T15:58:04.000+00:00"}
{"index": {"_id": 89}}
{"id": 89, "name": "华为(HUAWEI) 荣耀9青春版 全面屏手机 ", "subTitle": "高配尊享直降!人脸解锁!全屏四摄正反都美【官方正品 全国联保】拍送影视会员<a href=\"https://item.jd.com/26131514039.html\" target=\"_blank\">荣耀畅玩7c</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:07.000+00:00", "updateTime": "2018-04-21T15:58:07.000+00:00"}
{"index": {"_id": 90}}
{"id": 90, "name": "华为(HUAWEI) 荣耀7X 畅玩7X 手机 ", "subTitle": "【荣耀全面屏】麒麟八核 1600万后置双摄<a href=\"https://item.jd.com/25882037762.html\" target=\"_blank\">【荣耀新机→荣耀畅玩7C】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:09.000+00:00", "updateTime": "2018-04-21T15:58:09.000+00:00"}
{"index": {"_id": 91}}
{"id": 91, "name": "华为(HUAWEI) 华为 P10 全网通4G智能手机 ", "subTitle": "货票同行~支持七天保价,隔日达!<a href=\"https://item.jd.com/27179904421.html\" target=\"_blank\">预约抢购华为P20</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:13.000+00:00", "updateTime": "2018-04-21T15:58:13.000+00:00"}
{"index": {"_id": 92}}
{"id": 92, "name": "华为(HUAWEI) 荣耀9 手机 ", "subTitle": "【爆款 现货速发 全网通非阉割】 2000万变焦双摄,3D曲面极光玻璃! <a href=\"https://item.jd.com/11795379839.html\" target=\"_blank\">荣耀8青春版</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:15.000+00:00", "updateTime": "2018-04-21T15:58:15.000+00:00"}
{"index": {"_id": 93}}
{"id": 93, "name": "华为(HUAWEI) 华为P10 Plus 手机 ", "subTitle": "64G版本仅需2766元,256G 黑、金、玉色现货速发!<a href=\"https://item.jd.com/26652299286.html\" target=\"_blank\">P20 Pro点这</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:19.000+00:00", "updateTime": "2018-04-21T15:58:19.000+00:00"}
{"index": {"_id": 94}}
{"id": 94, "name": "华为(HUAWEI) 华为P20 手机 ", "subTitle": "大量现货 华为直供货源!自带原装耳机 华为<a href=\"https://item.jd.com/26881279035.html\" target=\"_blank\">P20pro</a> 现货抢购!", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:22.000+00:00", "updateTime": "2018-04-21T15:58:22.000+00:00"}
{"index": {"_id": 95}}
{"id": 95, "name": "华为(HUAWEI) 华为nova2S 全面屏手机 ", "subTitle": "送乐心运动手环+品胜10000毫安电源+暴风VR眼镜+usb分线器!<a href=\"https://item.jd.com/26399946248.html\" target=\"_blank\">华为nova3e</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:24.000+00:00", "updateTime": "2018-04-21T15:58:24.000+00:00"}
{"index": {"_id": 96}}
{"id": 96, "name": "华为(HUAWEI) nova 3e 手机 ", "subTitle": "【现货,送五重好礼】送壳膜+自拍杆+华为原装耳机+红包!<a href=\"https://item.jd.com/21678990946.html\" target=\"_blank\">nova2s热销中~</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:27.000+00:00", "updateTime": "2018-04-21T15:58:27.000+00:00"}
{"index": {"_id": 97}}
{"id": 97, "name": "华为(HUAWEI) 华为 畅享6s 4G手机 ", "subTitle": "指纹识别!金属机身!3+32大内存骁龙八核长续航!<a href=\"https://item.jd.com/21870224382.html\" target=\"_blank\">【华为新品抢先购→华为畅享8】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:29.000+00:00", "updateTime": "2018-04-21T15:58:29.000+00:00"}
{"index": {"_id": 98}}
{"id": 98, "name": "华为(HUAWEI) 荣耀 畅玩 6 全网通4G手机 双卡双待 ", "subTitle": "", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:31.000+00:00", "updateTime": "2018-04-21T15:58:31.000+00:00"}
{"index": {"_id": 99}}
{"id": 99, "name": "华为(HUAWEI) 荣耀9手机 ", "subTitle": "限时优惠标配下单立减50成交价低至1949元!送耳机 壳膜 ! <a href=\"https://item.jd.com/16006217377.html\" target=\"_blank\">荣耀V10低至2499</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:33.000+00:00", "updateTime": "2018-04-21T15:58:33.000+00:00"}
{"index": {"_id": 100}}
{"id": 100, "name": "华为(HUAWEI) 【白条免息】 华为V10荣耀V10 全网通手机 ", "subTitle": "京仓直发+三期免息+货到付款+评价惊喜参考赠品<a href=\"https://item.jd.com/26222134936.html\" target=\"_blank\">【红米note5 1088起 三期免息+赠品</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:36.000+00:00", "updateTime": "2018-04-21T15:58:36.000+00:00"}
{"index": {"_id": 101}}
{"id": 101, "name": "小米(MI) 小米红米4A 双卡双待4G手机 ", "subTitle": "", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:37.000+00:00", "updateTime": "2018-04-21T15:58:37.000+00:00"}
{"index": {"_id": 102}}
{"id": 102, "name": "华为(HUAWEI) 荣耀7C 畅玩7C 全面屏 全网通4G智能手机 ", "subTitle": "【京东仓发货 正品保证】现货速发!首批下单赠礼!全面屏!人脸识别,双摄美拍<a href=\"https://item.jd.com/26401034999.html\" target=\"_blank\">华为nova3e</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:39.000+00:00", "updateTime": "2018-04-21T15:58:39.000+00:00"}
{"index": {"_id": 103}}
{"id": 103, "name": "华为(HUAWEI) 荣耀7X 畅玩7x 手机 ", "subTitle": "送荣耀原装耳机+一万毫安电源限64/128G版本!现货速发!<a href=\"https://item.jd.com/26129180943.html\" target=\"_blank\">荣耀7C点这</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:41.000+00:00", "updateTime": "2018-04-21T15:58:41.000+00:00"}
{"index": {"_id": 104}}
{"id": 104, "name": "小米(MI) 红米5 Plus 全面屏 手机 ", "subTitle": "【江浙沪可享次日达】18:9全面屏,4000mAh大电池,骁龙八核处理器!<a href=\"https://item.jd.com/26187997701.html\" target=\"_blank\">红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:43.000+00:00", "updateTime": "2018-04-21T15:58:43.000+00:00"}
{"index": {"_id": 105}}
{"id": 105, "name": "小米(MI) 红米note5 手机 ", "subTitle": "【64G版现货开售】,下单送耳机!AI美颜双摄!暗光逆光更出色!<a href=\"https://item.jd.com/21685362088.html\" target=\"_blank\">红米5plus32G限秒!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:46.000+00:00", "updateTime": "2018-04-21T15:58:46.000+00:00"}
{"index": {"_id": 106}}
{"id": 106, "name": "小米(MI) 红米Note5 手机 ", "subTitle": "游戏手机 王者荣耀 吃鸡 AI双摄,逆光暗光更出色 <a href=\"https://item.jd.com/21757928932.html\" target=\"_blank\">红米5plus全面屏</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:47.000+00:00", "updateTime": "2018-04-21T15:58:47.000+00:00"}
{"index": {"_id": 107}}
{"id": 107, "name": "华为(HUAWEI) 荣耀6X畅玩6X手机 ", "subTitle": "【开学爆到此商品正在参加开学季大促】活动期间享优惠促销价!<a href=\"https://item.jd.com/25906780694.html\" target=\"_blank\">荣耀7C双摄全面屏999起!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:49.000+00:00", "updateTime": "2018-04-21T15:58:49.000+00:00"}
{"index": {"_id": 108}}
{"id": 108, "name": "小米(MI) 小米4A 红米4A 智能老年人手机 双卡双待 ", "subTitle": "【京东配送】1300万像素,骁龙处理器!轻盈小巧长续航,隐私双系统!<a href=\"https://item.jd.com/25716220476.html\" target=\"_blank\">红米5A现货速发</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:51.000+00:00", "updateTime": "2018-04-21T15:58:51.000+00:00"}
{"index": {"_id": 109}}
{"id": 109, "name": "小米(MI) 小米4A 红米4A 4G手机 ", "subTitle": "【现货速发京东物流】流畅打王者,信号稳定,通话清晰,5.0英寸屏,学生机。<a href=\"http://item.jd.com/17806958156.html\" target=\"_blank\">点击查看红米5A</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:52.000+00:00", "updateTime": "2018-04-21T15:58:52.000+00:00"}
{"index": {"_id": 110}}
{"id": 110, "name": "华为(HUAWEI) 华为P10 手机 ", "subTitle": "现货速发!送229元原装视窗保护套+壳膜扣套装!<a href=\"https://item.jd.com/26652078862.html\" target=\"_blank\">华为P20点这</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:58:55.000+00:00", "updateTime": "2018-04-21T15:58:55.000+00:00"}
{"index": {"_id": 111}}
{"id": 111, "name": "小米(MI) 红米5A 4G手机 ", "subTitle": "京东配送【移动版支持全网与全网版不做混发、请放心购买】<a href=\"https://item.jd.com/25617369448.html\" target=\"_blank\">购买全面屏红米NOTE5手机</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:57.000+00:00", "updateTime": "2018-04-21T15:58:57.000+00:00"}
{"index": {"_id": 112}}
{"id": 112, "name": "小米(MI) 小米mix2S 手机 ", "subTitle": "黑色全系列现货 游戏手机 骁龙845带你吃鸡/AI双摄双核极速对焦<a href=\"https://item.jd.com/21759433312.html\" target=\"_blank\">红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:58:58.000+00:00", "updateTime": "2018-04-21T15:58:58.000+00:00"}
{"index": {"_id": 113}}
{"id": 113, "name": "小米(MI) 小米5X 手机 ", "subTitle": "【店长推荐,现货速发】流畅打王者,骁龙处理器,5.5英寸屏,双摄拍照更美。<a href=\"https://item.jd.com/18787246601.html\" target=\"_blank\">红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:00.000+00:00", "updateTime": "2018-04-21T15:59:00.000+00:00"}
{"index": {"_id": 114}}
{"id": 114, "name": "小米(MI) 小米5A 红米5A 手机 ", "subTitle": "现货速发!5.0屏幕,1300万摄像头,高通骁龙处理器!<a href=\"https://item.jd.com/21579919293.html\" target=\"_blank\">新品红米5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:02.000+00:00", "updateTime": "2018-04-21T15:59:02.000+00:00"}
{"index": {"_id": 115}}
{"id": 115, "name": "小米(MI) 小米 红米note5A 手机 ", "subTitle": "【64G少量到货】1600万柔光自拍,高通骁龙处理器,2+1卡槽设计!<a href=\"https://item.jd.com/18787246601.html\" target=\"_blank\">爆款红米note5!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:06.000+00:00", "updateTime": "2018-04-21T15:59:06.000+00:00"}
{"index": {"_id": 116}}
{"id": 116, "name": "小米(MI) 红米Note5 全面屏 手机 ", "subTitle": "送耳机+壳膜+指环扣   游戏手机 \"吃鸡\"利器 王者荣耀  AI美颜双摄!<a href=\"https://item.jd.com/21676582422.html\" target=\"_blank\">红米5plus</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:09.000+00:00", "updateTime": "2018-04-21T15:59:09.000+00:00"}
{"index": {"_id": 117}}
{"id": 117, "name": "小米 红米5Plus 手机 ", "subTitle": "【全网通不混发丨原装防摔壳】18:9全面屏丨骁龙8核处理器→<a href=\"https://item.jd.com/21117453994.html\" target=\"_blank\">新品红米note5,1499元</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:11.000+00:00", "updateTime": "2018-04-21T15:59:11.000+00:00"}
{"index": {"_id": 118}}
{"id": 118, "name": "小米 note3 手机 ", "subTitle": "全网通版不混发丨含原装壳丨人脸解锁丨美颜+后置1200万丨快充丨NFC→<a href=\"http://item.jd.com/21117453994.html\" target=\"_blank\">新品红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:12.000+00:00", "updateTime": "2018-04-21T15:59:12.000+00:00"}
{"index": {"_id": 119}}
{"id": 119, "name": "小米(MI) 红米5 Plus 手机 全面屏 ", "subTitle": "【全网通,谢绝阉割版】全面屏,骁龙625处理器!<a href=\"https://item.jd.com/21759433312.html\" target=\"_blank\">全面屏-骁龙636-看新品-红米NOTE5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:14.000+00:00", "updateTime": "2018-04-21T15:59:14.000+00:00"}
{"index": {"_id": 120}}
{"id": 120, "name": "华为(HUAWEI) 荣耀V10 手机 ", "subTitle": "【荣耀旗舰】【下单赠壳膜】麒麟970!2000万AI变焦双摄<a href=\"https://item.jd.com/25882037762.html\" target=\"_blank\">【荣耀畅玩7C】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:59:16.000+00:00", "updateTime": "2018-04-21T15:59:16.000+00:00"}
{"index": {"_id": 121}}
{"id": 121, "name": "魅族 魅蓝Note5 全网通公开版 3GB+32GB ", "subTitle": "4000mAh真快充!金属指纹大运存!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:59:18.000+00:00", "updateTime": "2018-04-21T15:59:18.000+00:00"}
{"index": {"_id": 122}}
{"id": 122, "name": "魅族 魅蓝A5 移动定制版 2GB+16GB ", "subTitle": "小身量,大电量,3060mAh!800万像素主摄像头!<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:59:19.000+00:00", "updateTime": "2018-04-21T15:59:19.000+00:00"}
{"index": {"_id": 123}}
{"id": 123, "name": "魅族 PRO 7 4GB+64GB 全网通公开版 ", "subTitle": "12期免息,买送耳机(数量有限,送完即止)<a href='https://sale.jd.com/act/InqRKmz0tg.html' target='_blank'>魅蓝6秒杀大促,直降至599抢购!</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T15:59:22.000+00:00", "updateTime": "2018-04-21T15:59:22.000+00:00"}
{"index": {"_id": 124}}
{"id": 124, "name": "努比亚", "subTitle": "无边框体验/7.5mm轻薄机身和3000mAh电池/无界续航告别一天一充!<a  target=\"_blank\"  href=\"https://sale.jd.com/act/D0Q7hajCRAWrBL.html\">更多好货请点击</a>", "brandId": 27094, "saleable": true, "createTime": "2018-04-21T15:59:24.000+00:00", "updateTime": "2018-04-21T15:59:24.000+00:00"}
{"index": {"_id": 125}}
{"id": 125, "name": "vivo X20 全面屏 双摄美颜拍照手机 4GB+64GB ", "subTitle": "【直降200元,白条3期免息】18:9高清全面屏,指纹面部双解锁,逆光也清晰,照亮你的美!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩点击>>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T15:59:28.000+00:00", "updateTime": "2018-04-21T15:59:28.000+00:00"}
{"index": {"_id": 126}}
{"id": 126, "name": "vivo X9s Plus 全网通 美颜拍照手机 4GB+64GB ", "subTitle": "【3期免息,购机送好礼】旗舰产品,超高性价比!前置柔光拍摄!照亮你的美!部分地区有货,速来抢购!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T15:59:32.000+00:00", "updateTime": "2018-04-21T15:59:32.000+00:00"}
{"index": {"_id": 127}}
{"id": 127, "name": "努比亚(nubia)Z17 无边框 ", "subTitle": "旗舰无边框!8GB+64GB大内存!2300万+1200万变焦双摄!极速闪充!<a  target=\"_blank\"  href=\"http://item.jd.com/6994622.html?from_saf=1\">红魔游戏手机火热预约中</a>", "brandId": 27094, "saleable": true, "createTime": "2018-04-21T15:59:34.000+00:00", "updateTime": "2018-04-21T15:59:34.000+00:00"}
{"index": {"_id": 128}}
{"id": 128, "name": "华为(HUAWEI) Mate10 Pro 手机 ", "subTitle": "送华为原装视窗保护套+华为原装蓝牙音箱+品胜10000毫安电源+乐心运动手环!<a href=\"http://item.jd.com/18167356217.html\" target=\"_blank\">mate10</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:59:36.000+00:00", "updateTime": "2018-04-21T15:59:36.000+00:00"}
{"index": {"_id": 129}}
{"id": 129, "name": "小米(MI) 红米5 plus 手机 ", "subTitle": "18:9全面屏,4000mAh大电池,骁龙八核处理器!<a href=\"https://item.jd.com/21685362089.html\" target=\"_blank\">32G金色限时8XX秒!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:38.000+00:00", "updateTime": "2018-04-21T15:59:38.000+00:00"}
{"index": {"_id": 130}}
{"id": 130, "name": "小米(MI) 小米MIX2S 手机 ", "subTitle": "新品现货发售!全面屏陶瓷手机,高通处理器845,AI双摄双核极速对焦!<a href=\"https://item.jd.com/18787246601.html\" target=\"_blank\">爆款红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:39.000+00:00", "updateTime": "2018-04-21T15:59:39.000+00:00"}
{"index": {"_id": 131}}
{"id": 131, "name": "华为(HUAWEI) 华为nova2手机 ", "subTitle": "【移动版支持全网与全网版不做混发、请放心购买】<a href=\"https://item.jd.com/26397633043.html\" target=\"_blank\">【新品现货nova3e】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:59:42.000+00:00", "updateTime": "2018-04-21T15:59:42.000+00:00"}
{"index": {"_id": 132}}
{"id": 132, "name": "华为(HUAWEI) 华为nova青春版 手机 ", "subTitle": "【现货速发,京东配送】麒麟658!柔光护眼屏!双面弧面玻璃!<a href=\"https://item.jd.com/26510592706.html\" target=\"_blank\">华为P20震撼上市!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:59:44.000+00:00", "updateTime": "2018-04-21T15:59:44.000+00:00"}
{"index": {"_id": 133}}
{"id": 133, "name": "小米(MI) 红米note5 全面屏手机 ", "subTitle": "AI美颜双摄,人脸解锁,4000mAh大电量!点击<a href=\"https://sale.jd.com/m/act/hAaGFCsbdQ8xnMV.html\" target=\"_blank\">小米特惠专场</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:48.000+00:00", "updateTime": "2018-04-21T15:59:48.000+00:00"}
{"index": {"_id": 134}}
{"id": 134, "name": "小米 红米Note4X 全网通版 ", "subTitle": "<a href=\"https://item.jd.com/26438399057.html\" target=\"_blank\">【小米新品】~红米note5 AI智能双摄</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:51.000+00:00", "updateTime": "2018-04-21T15:59:51.000+00:00"}
{"index": {"_id": 135}}
{"id": 135, "name": "小米(MI) mix2s全面屏游戏手机 ", "subTitle": "京东配送好礼64G现货高通处理器845AI双摄双核极速对焦~<a href=\"https://item.jd.com/16716408877.html\" target=\"_blank\">小米mix2热卖中~!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:52.000+00:00", "updateTime": "2018-04-21T15:59:52.000+00:00"}
{"index": {"_id": 136}}
{"id": 136, "name": "小米(MI) 小米note3 手机 亮", "subTitle": "5.5英寸屏,骁龙660,人脸解锁,双摄镜头拍人更美!<a href=\"https://item.jd.com/18787246601.html\" target=\"_blank\">爆款红米note5现货!</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:53.000+00:00", "updateTime": "2018-04-21T15:59:53.000+00:00"}
{"index": {"_id": 137}}
{"id": 137, "name": "小米(MI) 红米5 Plus 全网通4G 移动联通电信4G智能手机 双卡双待 ", "subTitle": "18:9千元全面屏,前置柔光自拍,骁龙8核处理器<a href=\"https://item.jd.com/26438399057.html\" target=\"_blank\">【小米新品】~红米note5 AI智能双摄</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:55.000+00:00", "updateTime": "2018-04-21T15:59:55.000+00:00"}
{"index": {"_id": 138}}
{"id": 138, "name": "小米(MI) 小米 MIX2S 全面屏 游戏手机 双卡双待 ", "subTitle": "【推荐256G黑色现货速发 白色预订30天发货】高通处理器845,AI双摄双核极速对焦", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:56.000+00:00", "updateTime": "2018-04-21T15:59:56.000+00:00"}
{"index": {"_id": 139}}
{"id": 139, "name": "华为(HUAWEI) 荣耀 V9 Play手机 ", "subTitle": "科技美学,北欧极简设计<a href=\"https://item.jd.com/15936740403.html\" target=\"_blank\">【荣耀全面屏→荣耀7x】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T15:59:57.000+00:00", "updateTime": "2018-04-21T15:59:57.000+00:00"}
{"index": {"_id": 140}}
{"id": 140, "name": "小米(MI) 小米MIX2S 全面屏手机 ", "subTitle": "高通处理器845,AI双摄,支持无线快充 <a href=\"https://item.jd.com/26262075570.html\" target=\"_blank\">红米note5</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T15:59:58.000+00:00", "updateTime": "2018-04-21T15:59:58.000+00:00"}
{"index": {"_id": 141}}
{"id": 141, "name": "小米 MI 6.1 手机  ", "subTitle": "含原装壳丨变焦双摄丨骁龙处理器丨NFC丨<a href=\"https://item.jd.com/22320392453.html\" target=\"_blank\">小米note3骁龙八核处理器</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:00:00.000+00:00", "updateTime": "2019-03-28T15:00:44.000+00:00"}
{"index": {"_id": 142}}
{"id": 142, "name": "小米(MI) 红米note5 手机 ", "subTitle": "【赠多重好礼】 游戏手机 王者荣耀 吃鸡 AI双摄逆光暗光更出色/<a href=\"https://item.jd.com/21676464002.html\" target=\"_blank\">红米5plus推广中</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:00:02.000+00:00", "updateTime": "2018-04-21T16:00:02.000+00:00"}
{"index": {"_id": 143}}
{"id": 143, "name": "华为(HUAWEI) 荣耀9青春版 手机 ", "subTitle": "【下单赠钢化膜】全屏四摄正反都美<a href=\"https://item.jd.com/25882037762.html\" target=\"_blank\">【选“C”没错→荣耀畅玩7C】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:06.000+00:00", "updateTime": "2018-04-21T16:00:06.000+00:00"}
{"index": {"_id": 144}}
{"id": 144, "name": "华为(HUAWEI) 华为 畅享6S 手机 ", "subTitle": "指纹识别!金属机身!3+32大内存骁龙八核长续航!<a href=\"https://item.jd.com/16097496669.html\" target=\"_blank\">中兴A3特惠促销,下单有礼</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:08.000+00:00", "updateTime": "2018-04-21T16:00:08.000+00:00"}
{"index": {"_id": 145}}
{"id": 145, "name": "锤子(smartisan) 坚果32 手机 ", "subTitle": "【新品开售享壕礼】下单即送智能手环、蓝牙耳机、自拍杆~ <a href=\"https://item.jd.com/19566307882.html\" target=\"_blank\">点击购买坚果 Pro2 !</a>", "brandId": 91515, "saleable": true, "createTime": "2018-04-21T16:00:09.000+00:00", "updateTime": "2018-04-29T11:26:43.000+00:00"}
{"index": {"_id": 146}}
{"id": 146, "name": "华为(HUAWEI) Nova3e 手机 ", "subTitle": "【京东配 三期免息】现货销售,下单即送多重好礼!!<a href=\"https://item.jd.com/25642117158.html\" target=\"_blank\">【新品畅享8 白条免息抢现货】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:11.000+00:00", "updateTime": "2018-04-21T16:00:11.000+00:00"}
{"index": {"_id": 147}}
{"id": 147, "name": "华为(HUAWEI) nova青春版 手机 ", "subTitle": "【现货速发】麒麟658!柔光护眼屏!双面弧面玻璃!点击<a href=\"https://item.jd.com/21381869254.html\" target=\"_blank\">畅享7s</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:14.000+00:00", "updateTime": "2018-04-21T16:00:14.000+00:00"}
{"index": {"_id": 148}}
{"id": 148, "name": "vivo X21 新一代全面屏 双摄拍照手机 移动联通电信4G 双卡双待 ", "subTitle": "<a href=\"https://sale.jd.com/act/vGWKogOy2nbPpQ.html\" target=\"_blank\">vivo X21新一代全面屏·6+128G大内存·AI智慧拍照·照亮你的美·现货抢购中</a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:00:16.000+00:00", "updateTime": "2018-04-21T16:00:16.000+00:00"}
{"index": {"_id": 149}}
{"id": 149, "name": "华为(HUAWEI) 麦芒5手机(4G+64G)全网通高配版 4G手机 双卡双待 ", "subTitle": "高配4+64G版金色现货速发 高通骁龙625芯片金属机身", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:18.000+00:00", "updateTime": "2018-04-21T16:00:18.000+00:00"}
{"index": {"_id": 150}}
{"id": 150, "name": "华为(HUAWEI) nova 3e全面屏手机 ", "subTitle": "送荣耀自拍杆+荣耀2合1数据线+荣耀手机支架+优质钢化膜!<a href=\"https://item.jd.com/21685713775.html\" target=\"_blank\">华为Nova 2S</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:21.000+00:00", "updateTime": "2018-04-21T16:00:21.000+00:00"}
{"index": {"_id": 151}}
{"id": 151, "name": "魅族(MEIZU) 魅蓝note6 手机 ", "subTitle": "1600万前置美拍,后置双摄像头,高通骁龙625处理器!<a href=\"https://item.jd.com/25644003916.html\" target=\"_blank\">【新品魅蓝E3】</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:23.000+00:00", "updateTime": "2018-04-21T16:00:23.000+00:00"}
{"index": {"_id": 152}}
{"id": 152, "name": "vivo Y69 全网通手机 3GB+32GB移动联通电信4G手机双卡双待 ", "subTitle": "", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:00:25.000+00:00", "updateTime": "2018-04-21T16:00:25.000+00:00"}
{"index": {"_id": 153}}
{"id": 153, "name": "华为(HUAWEI) 华为 麦芒5 手机 ", "subTitle": "【现货速发】5.5英寸大屏、八核处理器! <a href=\"https://item.jd.com/16986927363.html\" target=\"_blank\">【新品麦芒6】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:26.000+00:00", "updateTime": "2018-04-21T16:00:26.000+00:00"}
{"index": {"_id": 154}}
{"id": 154, "name": "魅族(MEIZU) 魅蓝S6 手机 ", "subTitle": "疾速游戏芯片 侧面指纹 全面屏!<a href=\"https://item.jd.com/25644003916.html\" target=\"_blank\">新品魅蓝E3</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:28.000+00:00", "updateTime": "2018-04-21T16:00:28.000+00:00"}
{"index": {"_id": 155}}
{"id": 155, "name": "魅族(MEIZU) 魅蓝S6 手机 ", "subTitle": "支持京东配到付,三星Exynos芯片 全面屏侧边指纹识别 评价晒图返好礼", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:30.000+00:00", "updateTime": "2018-04-21T16:00:30.000+00:00"}
{"index": {"_id": 156}}
{"id": 156, "name": "魅族(MEIZU) 魅族6 魅蓝6 手机 ", "subTitle": "【送壳,膜现货即发】高颜值!800万+1300万像素!八核处理器!<a href=\"https://item.jd.com/25644003916.html\" target=\"_blank\">新品魅蓝E3</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:32.000+00:00", "updateTime": "2018-04-21T16:00:32.000+00:00"}
{"index": {"_id": 157}}
{"id": 157, "name": "vivo Y67 全网通 美颜拍照手机 4GB+", "subTitle": "【3期免息,购机送好礼】火爆!超高性价比!1600万柔光自拍!照亮你的美!仅部分地区有货,速来抢购!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:00:37.000+00:00", "updateTime": "2018-04-21T16:00:37.000+00:00"}
{"index": {"_id": 158}}
{"id": 158, "name": "诺基亚 7 (Nokia 7) ", "subTitle": "【白条6期免息】6GB内存,蔡司摄像头,OZO音频技术~<a  target=\"_blank\"  href=\"https://sale.jd.com/act/4uxod5tD1mH.html\">猛戳进入主会场>></a>", "brandId": 13539, "saleable": true, "createTime": "2018-04-21T16:00:38.000+00:00", "updateTime": "2018-04-21T16:00:38.000+00:00"}
{"index": {"_id": 159}}
{"id": 159, "name": "【送水晶项链】vivo X20 Plus 全面屏", "subTitle": "【6期免息】18:9全面屏!超大屏幕,多送项链礼盒,更超值!游戏免打扰模式!畅快开黑!部分地区有货,速来抢购!<a href='https://sale.jd.com/act/YwJvQOrbPKaLE2.html' target='_blank'>更多精彩请点击>></a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:00:41.000+00:00", "updateTime": "2018-04-21T16:00:41.000+00:00"}
{"index": {"_id": 160}}
{"id": 160, "name": "魅族(MEIZU) 魅蓝E3 全面屏手机 全网通4G手机 ", "subTitle": "【128G金色少量到货】预售30天发货 骁龙8核处理器,6G大内存,索尼双摄,低温快充", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:44.000+00:00", "updateTime": "2018-04-21T16:00:44.000+00:00"}
{"index": {"_id": 161}}
{"id": 161, "name": "魅族(MEIZU) 魅蓝E3手机 ", "subTitle": "魅蓝E3 金色现货发售!6G大内存,索尼双摄,低温快充!<a href=\"https://item.jd.com/15610845217.html\" target=\"_blank\">魅蓝note6大促中</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:45.000+00:00", "updateTime": "2018-04-21T16:00:45.000+00:00"}
{"index": {"_id": 162}}
{"id": 162, "name": "小米(MI) 小米MAX2 手机 6.44英寸 大屏幕 ", "subTitle": "现货速发 6.44英寸屏幕,骁龙625处理器!热卖新品<a href=\"https://item.jd.com/26266519559.html\" target=\"_blank\">红米note5~</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:00:47.000+00:00", "updateTime": "2018-04-21T16:00:47.000+00:00"}
{"index": {"_id": 163}}
{"id": 163, "name": "魅族(MEIZU) 魅蓝note6 全网通4G手机 双卡双待 ", "subTitle": "<a href=\"https://item.jd.com/16844585370.html\" target=\"_blank\">(晒图写心得拿影视会员)@note6全网通香槟金仅需799!</a>送硅胶.钢化.耳机", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:00:49.000+00:00", "updateTime": "2018-04-21T16:00:49.000+00:00"}
{"index": {"_id": 164}}
{"id": 164, "name": "华为(HUAWEI) 荣耀8 手机 ", "subTitle": "【店长推荐】美得与众不同!<a href=\"https://item.jd.com/25882037762.html\" target=\"_blank\">【荣耀新款全面屏手机→荣耀畅玩7C】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:51.000+00:00", "updateTime": "2018-04-21T16:00:51.000+00:00"}
{"index": {"_id": 165}}
{"id": 165, "name": "小米(MI) 小米note3 手机 ", "subTitle": "赠壳膜全国联保京东配送/屏四曲面陶瓷机身骁龙835<a href=\"https://item.jd.com/16716408877.html\" target=\"_blank\">小米MIX2点击购买</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:00:54.000+00:00", "updateTime": "2018-04-21T16:00:54.000+00:00"}
{"index": {"_id": 166}}
{"id": 166, "name": "华为(HUAWEI) Mate10 手机 ", "subTitle": "送华为原装视窗保护套+华为原装蓝牙耳机+乐心运动手环+钢化膜等!<a href=\"https://item.jd.com/18180585426.html\" target=\"_blank\">mate10pro</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:56.000+00:00", "updateTime": "2018-04-21T16:00:56.000+00:00"}
{"index": {"_id": 167}}
{"id": 167, "name": "华为(HUAWEI) 畅享6S 移动联通电信4G手机 ", "subTitle": "【正品国行,全新原封】骁龙芯片!金属机身!享看又享玩!<a href=\"https://item.jd.com/12207790357.html\" target=\"_blank\">荣耀8青春热卖中!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:00:57.000+00:00", "updateTime": "2018-04-21T16:00:57.000+00:00"}
{"index": {"_id": 168}}
{"id": 168, "name": "小米(MI) 小米5X 手机 ", "subTitle": "【爆款低价 移动/公开全网通不做混发,请放心购买!】5.5”屏幕,变焦双摄!<a href=\"https://item.jd.com/12068579160.html\" target=\"_blank\">戳戳小米6~</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:00:59.000+00:00", "updateTime": "2018-04-21T16:00:59.000+00:00"}
{"index": {"_id": 169}}
{"id": 169, "name": "华为(HUAWEI) 荣耀V10手机 ", "subTitle": "【下单立减】送荣耀自拍杆+荣耀2合1数据线+荣耀手机支架+壳膜套装!<a href=\"https://item.jd.com/25749144099.html\" target=\"_blank\">荣耀畅玩7X</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:02.000+00:00", "updateTime": "2018-04-21T16:01:02.000+00:00"}
{"index": {"_id": 170}}
{"id": 170, "name": "魅族(MEIZU) 魅族 魅蓝A5 4G手机 双卡双待 ", "subTitle": "魅族新品千元机", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:01:03.000+00:00", "updateTime": "2018-04-21T16:01:03.000+00:00"}
{"index": {"_id": 171}}
{"id": 171, "name": "华为(HUAWEI) 华为P20 Pro 全面屏 手机 ", "subTitle": "【全国多仓发货】送价值158元原装礼盒(自拍杆+数据线+指环扣)+原装耳机!<a href=\"https://item.jd.com/13039618422.html\" target=\"_blank\">抢华为P20</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:05.000+00:00", "updateTime": "2018-04-21T16:01:05.000+00:00"}
{"index": {"_id": 172}}
{"id": 172, "name": "华为(HUAWEI) 华为 畅享6S 手机 ", "subTitle": "京东配送!  骁龙芯片!金属机身!  <a href=\"https://item.jd.com/21669543700.html\" target=\"_blank\">【新品畅享7s】</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:07.000+00:00", "updateTime": "2018-04-21T16:01:07.000+00:00"}
{"index": {"_id": 173}}
{"id": 173, "name": "华为(HUAWEI) 荣耀 畅玩6 全网通4G智能手机 双卡双待 2G+16G ", "subTitle": "【京东仓发货 正品保证】柔光自拍,舒适握感,长续航!<a href=\"https://item.jd.com/26134956416.html\" target=\"_blank\">新品荣耀畅玩7C!</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:08.000+00:00", "updateTime": "2018-04-21T16:01:08.000+00:00"}
{"index": {"_id": 174}}
{"id": 174, "name": "小米(MI) 红米5 Plus 4+64G 全面屏手机 双卡双待 ", "subTitle": "下单送好礼 自营配送 18:9千元全面屏 前置柔光自拍 4000毫安大电池 骁龙八核处理器", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:01:10.000+00:00", "updateTime": "2018-04-21T16:01:10.000+00:00"}
{"index": {"_id": 175}}
{"id": 175, "name": "华为(HUAWEI) nova 3e 手机 ", "subTitle": "【现货,送五重好礼】前置2400万自然美妆,送华为原装耳机等!<a href=\"https://item.jd.com/21698630782.html\" target=\"_blank\">华为nova2s热销中~</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:13.000+00:00", "updateTime": "2018-04-21T16:01:13.000+00:00"}
{"index": {"_id": 176}}
{"id": 176, "name": "vivo X21 屏幕指纹 双摄拍照手机 6GB+128GB 移动联通电信4G 双卡双待 ", "subTitle": "【稀缺货品】屏幕指纹识别·3D曲面背部玻璃·AI智慧拍照·照亮你的美·<a href=\"https://sale.jd.com/act/vGWKogOy2nbPpQ.html\" target=\"_blank\">更多精彩点击</a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:01:14.000+00:00", "updateTime": "2018-04-21T16:01:14.000+00:00"}
{"index": {"_id": 177}}
{"id": 177, "name": "小米(MI) 小米Max2 手机 双卡双待 ", "subTitle": "【小米大屏手机】6.44英寸屏,5300毫安电池。大屏玩王者荣耀更爽!<a href=\"https://item.jd.com/13038819059.html\" target=\"_blank\">变焦双摄小米5X</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:01:16.000+00:00", "updateTime": "2018-04-21T16:01:16.000+00:00"}
{"index": {"_id": 178}}
{"id": 178, "name": "华为(HUAWEI) 荣耀 畅玩6 手机 ", "subTitle": "【京仓直发】柔光自拍,舒适握感,长续航!<a href=\"https://item.jd.com/25882037762.html\" target=\"_blank\">【荣耀</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:17.000+00:00", "updateTime": "2018-04-21T16:01:17.000+00:00"}
{"index": {"_id": 179}}
{"id": 179, "name": "华为(HUAWEI) 荣耀7C 畅玩7C手机 全网通4G 全面屏 ", "subTitle": "【官方正品 全国联保】人脸识别 双摄美拍!高配拍送荣耀耳机<a href=\"https://item.jd.com/26131514041.html\" target=\"_blank\">@64G优惠购</a>", "brandId": 8557, "saleable": true, "createTime": "2018-04-21T16:01:19.000+00:00", "updateTime": "2018-04-21T16:01:19.000+00:00"}
{"index": {"_id": 180}}
{"id": 180, "name": "魅族(MEIZU) pro 6 plus手机 移动联通版 ", "subTitle": "【现货 劲爆价促销】<a href=\"https://item.jd.com/25109782095.html\" target=\"_blank\">魅蓝6 低至649元 评价更有好礼送</a>", "brandId": 12669, "saleable": true, "createTime": "2018-04-21T16:01:21.000+00:00", "updateTime": "2018-04-21T16:01:21.000+00:00"}
{"index": {"_id": 181}}
{"id": 181, "name": "vivo Y75 全面屏手机 4GB+32GB 移动联通电信4G手机 双卡双待 ", "subTitle": "<a href=\"https://sale.jd.com/act/vGWKogOy2nbPpQ.html\" target=\"_blank\">vivo X21新一代全面屏·6+128G大内存·AI智慧拍照·照亮你的美·现货抢购中</a>", "brandId": 25591, "saleable": true, "createTime": "2018-04-21T16:01:24.000+00:00", "updateTime": "2018-04-21T16:01:24.000+00:00"}
{"index": {"_id": 182}}
{"id": 182, "name": "小米(MI) 小米5X 全网通4G智能手机 ", "subTitle": "骁龙 八核CPU处理器 5.5英寸屏幕<a href=\"https://item.jd.com/26438399057.html\" target=\"_blank\">【小米新品】~红米note5 AI智能双摄</a>", "brandId": 18374, "saleable": true, "createTime": "2018-04-21T16:01:27.000+00:00", "updateTime": "2018-04-21T16:01:27.000+00:00"}
{"index": {"_id": 186}}
{"id": 186, "name": "OPPO V20", "subTitle": "666", "brandId": 2032, "saleable": true, "createTime": "2019-03-17T21:47:14.000+00:00", "updateTime": "2019-03-17T21:47:14.000+00:00"}

短信索引

PUT /sms-logs-index
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "id" : {
        "type" : "long"
      },
      "createDate" : {
        "type" : "date"
      },
      "sendDate" : {
        "type" : "date"
      },
      "longCode" : {
        "type" : "keyword"
      },
      "mobile" : {
        "type" : "keyword"
      },
      "corpName" : {
        "type" : "keyword"
      },
      "smsContent" : {
        "type" : "text",
        "analyzer": "ik_max_word"
      },
      "state" : {
        "type" : "integer"
      },
      "operatorId" : {
        "type" : "integer"
      },
      "province" : {
        "type" : "keyword"
      },
      "ipAddr" : {
        "type" : "ip"
      },
      "replyTotal" : {
        "type" : "integer"
      },
      "fee" : {
        "type" : "long"
      }
    }
  }
}
PUT /sms-logs-index/_bulk
{"index": {"_id": 21}}
{"id": 21, "createDate": 1612271254634, "sendDate": 1612271254634, "longCode": "10690000988", "mobile": "13800000000", "corpName": "途虎养车", "smsContent": "【途虎养车】亲爱的张三先生/女士,您在途虎购买的货品(单号TH123456)已 到指定安装店多日,现需与您确认订单的安装情况,请点击链接按实际情况选择(此链接有效期为72H)。您也可以登录途 虎APP进入“我的-待安装订单”进行预约安装。若您在服务过程中有任何疑问,请致电400-111-8868向途虎咨 询。", "state": 0, "operatorId": 1, "province": "北京", "ipAddr": "10.126.2.9", "replyTotal": 10, "fee": 3}
{"index": {"_id": 31}}
{"id": 31, "createDate": 1612271255108, "sendDate": 1612271255108, "longCode": "10650000998", "mobile": "13600000000", "corpName": "中国移动", "smsContent": "【北京移动】尊敬的客户137****0000,5月话费账单已送达您的139邮箱,点击查看账单详情 http://y.10086.cn/;  回Q关闭通知,关注“中国移动139邮箱”微信随时查账单【中国移动 139邮箱】", "state": 0, "operatorId": 1, "province": "武汉", "ipAddr": "10.126.2.8", "replyTotal": 60, "fee": 4}
{"index": {"_id": 29}}
{"id": 29, "createDate": 1612271255041, "sendDate": 1612271255041, "longCode": "10690000998", "mobile": "13700000000", "corpName": "中国平安保险有限公司", "smsContent": "【中国平安】奋斗的时代,更需要健康的身体。中国平安为您提供多重健康保 障,在奋斗之路上为您保驾护航。退订请回复TD", "state": 0, "operatorId": 1, "province": "武汉", "ipAddr": "10.126.2.8", "replyTotal": 18, "fee": 5}
{"index": {"_id": 23}}
{"id": 23, "createDate": 1612271254812, "sendDate": 1612271254812, "longCode": "10660000988", "mobile": "13100000000", "corpName": "盒马鲜生", "smsContent": "【盒马】您尾号12345678的订单已开始配送,请在您指定的时间收货不要走开 哦~配送员:刘三,电话:13800000000", "state": 0, "operatorId": 2, "province": "北京", "ipAddr": "10.126.2.9", "replyTotal": 15, "fee": 5}
{"index": {"_id": 24}}
{"id": 24, "createDate": 1612271254812, "sendDate": 1612271254812, "longCode": "10660000988", "mobile": "18600000001", "corpName": "盒马鲜生", "smsContent": "【盒马】您尾号7775678的订单已开始配送,请在您指定的时间收货不要走开 哦~配送员:王五,电话:13800000001", "state": 0, "operatorId": 2, "province": "上海", "ipAddr": "10.126.2.9", "replyTotal": 15, "fee": 5}
{"index": {"_id": 30}}
{"id": 30, "createDate": 1612271255041, "sendDate": 1612271255041, "longCode": "10690000998", "mobile": "13990000002", "corpName": "中国平安保险有限公司", "smsContent": "【招商银行】尊贵的王五先生,恭喜您获得iphone 56抽奖资格,还可领5 元打车红包,仅限100天", "state": 0, "operatorId": 1, "province": "武汉", "ipAddr": "10.126.2.8", "replyTotal": 18, "fee": 5}
{"index": {"_id": 27}}
{"id": 27, "createDate": 1612271254961, "sendDate": 1612271254961, "longCode": "10690000988", "mobile": "13900000000", "corpName": "招商银行", "smsContent": "【招商银行】尊贵的李四先生,恭喜您获得华为P30 Pro抽奖资格,还可领100 元打车红包,仅限1天", "state": 0, "operatorId": 1, "province": "上海", "ipAddr": "10.126.2.8", "replyTotal": 50, "fee": 8}
{"index": {"_id": 28}}
{"id": 28, "createDate": 1612271254961, "sendDate": 1612271254961, "longCode": "10690000988", "mobile": "13990000001", "corpName": "招商银行", "smsContent": "【招商银行】尊贵的李四先生,恭喜您获得华为P30 Pro抽奖资格,还可领100 元打车红包,仅限1天", "state": 0, "operatorId": 1, "province": "武汉", "ipAddr": "10.126.2.8", "replyTotal": 50, "fee": 8}
{"index": {"_id": 25}}
{"id": 25, "createDate": 1612271254881, "sendDate": 1612271254881, "longCode": "10660000988", "mobile": "15300000000", "corpName": "滴滴打车", "smsContent": "【滴滴单车平台】专属限时福利!青桔/小蓝月卡立享5折,特惠畅骑30天。戳 https://xxxxxx退订TD", "state": 1, "operatorId": 3, "province": "上海", "ipAddr": "10.126.2.8", "replyTotal": 50, "fee": 7}
{"index": {"_id": 26}}
{"id": 26, "createDate": 1612271254881, "sendDate": 1612271254881, "longCode": "10660000988", "mobile": "18000000001", "corpName": "滴滴打车", "smsContent": "【滴滴单车平台】专属限时福利!青桔/小蓝月卡立享5折,特惠畅骑30天。戳 https://xxxxxx退订TD", "state": 1, "operatorId": 3, "province": "武汉", "ipAddr": "10.126.2.8", "replyTotal": 50, "fee": 7}

汽车索引

PUT /cars
{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "color": {
        "type": "keyword"
      },
      "make": {
        "type": "keyword"
      }
    }
  }
}
POST /cars/_bulk
{ "index": {"_id": 1}}
{ "price" : 10000, "color" : "red", "make" : "honda", "sold" : "2014-10-28" }
{ "index": {"_id": 2}}
{ "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" }
{ "index": {"_id": 3}}
{ "price" : 30000, "color" : "green", "make" : "ford", "sold" : "2014-05-18" }
{ "index": {"_id": 4}}
{ "price" : 15000, "color" : "blue", "make" : "toyota", "sold" : "2014-07-02" }
{ "index": {"_id": 5}}
{ "price" : 12000, "color" : "green", "make" : "toyota", "sold" : "2014-08-19" }
{ "index": {"_id": 6}}
{ "price" : 20000, "color" : "red", "make" : "honda", "sold" : "2014-11-05" }
{ "index": {"_id": 7}}
{ "price" : 80000, "color" : "red", "make" : "bmw", "sold" : "2014-01-01" }
{ "index": {"_id": 8}}
{ "price" : 25000, "color" : "blue", "make" : "ford", "sold" : "2014-02-12" }

Kibana查看索引信息

左上角菜单栏

Stack Management

Index Management

检索

全量检索【重点】

Match all

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html

查询全部内容,不指定任何查询条件。

POST /sms-logs-index/_search
{
  "query": {
    "match_all": {}
  }
}

精确检索

Term-level queries

IDs【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-ids-query.html

根据多个id查询

POST /sms-logs-index/_search
{
  "query": {
    "ids": {
      "values": [2,3,4]
    }
  }
}

Term【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html

完全匹配查询

POST /sms-logs-index/_search
{
  "query": {
    "term": {
      "province": "北京"
    }
  }
}

Terms【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html

完全匹配查询

POST /sms-logs-index/_search
{
  "query": {
    "terms": {
      "province": [
        "北京",
        "山西",
        "武汉"
      ]
    }
  }
}

Range【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html

范围查询,只针对数值类型

POST /sms-logs-index/_search
{
  "query": {
    "range": {
      "fee": {
        "gt": 5,
        "lte": 10
      }
    }
  }
}

可以使用 :

gt:>

gte:>=

lt:<

lte:<=

Prefix【性能差】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html

前缀查询

POST /sms-logs-index/_search
{
  "query": {
    "prefix": {
      "corpName": {
        "value": "途虎"
      }
    }
  }
}

Fuzzy【性能差】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-fuzzy-query.html

模糊查询

POST /sms-logs-index/_search
{
  "query": {
    "fuzzy": {
      "corpName": {
        "value": "盒马先生",
        "prefix_length": 2
      }
    }
  }
}
  • prefix_length

    指定前面几个字符是不允许出现错误的

Wildcard【性能差】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html

通配符查询

POST /sms-logs-index/_search
{
  "query": {
    "wildcard": {
      "corpName": {
        "value": "中国*"
      }
    }
  }
}
通配符
  • *
  • ?

Regexp【性能差】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html

正则查询

POST /sms-logs-index/_search
{
  "query": {
    "regexp": {
      "mobile": "180[0-9]{8}"
    }
  }
}

全文检索

Full text queries

全文检索属于高级查询,会根据查询字段的类型,采用不同的查询方式。

Match【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html

指定一个Field作为筛选的条件

POST /sms-logs-index/_search
{
  "query": {
    "match": {
      "smsContent": "收货安装"
    }
  }
}
POST /sms-logs-index/_search
{
  "query": {
    "match": {
      "smsContent": {
        "query": "中国 健康",
        "operator": "and"
      }
    }
  }
}
POST /sms-logs-index/_search
{
  "query": {
    "match": {
      "smsContent": {
        "query": "中国 健康",
        "operator": "or"
      }
    }
  }
}
参数
  • query

检索关键字

  • prefix_length

  • operator

    • OR (Default)
    • AND

Multi-match【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html

指定多个Field作为筛选的条件

POST /sms-logs-index/_search
{
  "query": {
    "multi_match": {
      "query": "北京",
      "fields": ["province","smsContent"]
    }
  }
}

复合检索

Compound queries

Boolean【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html

将多个查询条件,以一定的逻辑复合在一起。

  • must: 所有的条件,用must组合在一起,表示And的意思
  • must_not:将must_not中的条件,全部都不能匹配,标识Not的意思
  • should:所有的条件,用should组合在一起,表示Or的意思

查询:

  1. 省份为武汉或者北京
  2. 运营商不是联通
  3. 信息内容包含中国和平安
POST /sms-logs-index/_search
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "province": {
              "value": "北京"
            }
          }
        },
        {
          "term": {
            "province": {
              "value": "武汉"
            }
          }
        }
      ],
      "must_not": [
        {
          "term": {
            "operatorId": {
              "value": "2"
            }
          }
        }
      ],
      "must": [
        {
          "match": {
            "smsContent": "中国"
          }
        },
        {
          "match": {
            "smsContent": "平安"
          }
        }
      ]
    }
  }
}

Boosting【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-boosting-query.html

影响查询后的score

  • positive:只有匹配上positive的查询的内容,才会被放到返回的结果集中。
  • negative:如果匹配上和positive并且也匹配上了negative,就可以降低这样的文档score。
  • negative_boost:指定系数,必须小于1.0

检索时,分数是如何计算的

  • 搜索的关键字在文档中出现的次数越多,分数越高
  • 指定的文档内容越短,分数越高
  • 检索时,指定的关键字也会被分词,分词后的内容,被分词库匹配的次数越多,分数越高

$$score_{query,document}=\sum_{t}^q\sqrt{TF_{t,d}}IDF_{t,d}^2norm(d,field)*boost(t)$$

POST /sms-logs-index/_search
{
  "query": {
    "boosting": {
      "positive": {
        "match": {
          "smsContent": "收货安装"
        }
      },
      "negative": {
        "match": {
          "smsContent": "王五"
        }
      },
      "negative_boost": 0.5
    }
  }
}

聚合检索

Aggregations

聚合能够得到一个数据的概览。能够分析和总结全套的数据,而不是寻找单个文档:

  • 在大海里有多少针?
  • 针的平均长度是多少?
  • 按照针的制造商来划分,针的长度平均值是多少?
  • 每月加入到海中的针有多少?

聚合也可以回答更加细微的问题:

  • 最受欢迎的针的制造商是什么?
  • 这里面有异常的针么?

要掌握聚合,需要明白两个主要的概念:

  • 桶(Buckets)

    满足特定条件的文档的集合

  • 指标/度量(Metrics)

    对桶内的文档进行统计计算

每个聚合都是桶和指标的组合。翻译成粗略的 SQL 语句来解释:

sql
SELECT COUNT(color) 
FROM table
GROUP BY color
  • COUNT(color) 相当于指标。
  • GROUP BY color 相当于桶。

桶在概念上类似于 SQL 的分组(GROUP BY),而指标则类似于 COUNT()SUM()MAX() 等统计方法。

桶聚合

Buckets aggregation

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket.html

Terms aggregation【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-terms-aggregation.html

  • 按照汽车颜色color划分
GET /cars/_search
{
  "aggs" : { 
    "popular_colors" : { 
      "terms" : { 
        "field" : "color"
      }
    }
  }
}
Histogram aggregation【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html

阶梯分桶

  • 对汽车的价格进行分组,指定间隔 interval 为 5000
GET /cars/_search
{
  "aggs":{
    "price":{
      "histogram": {
        "field": "price",
        "interval": 5000,
        "min_doc_count": 1
      }
    }
  }
}
Range aggregation【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-range-aggregation.html

统计一定范围内出现的文档个数

  • 数值范围统计
POST /sms-logs-index/_search
{
  "aggs": {
    "agg": {
      "range": {
        "field": "fee",
        "ranges": [
          {
            "to": 5
          },
          {
            "from": 5,
            "to": 10
          },
          {
            "from": 10
          }
        ]
      }
    }
  }
}
  • 时间范围统计
POST /sms-logs-index/_search
{
  "aggs": {
    "agg": {
      "date_range": {
        "field": "createDate",
        "format": "yyyy", 
        "ranges": [
          {
            "to": 2000
          },
          {
            "from": 2000
          }
        ]
      }
    }
  }
}
  • ip 范围统计
POST /sms-logs-index/_search
{
  "aggs": {
    "agg": {
      "ip_range": {
        "field": "ipAddr",
        "ranges": [
          {
            "to": "10.126.2.9"
          },
          {
            "from": "10.126.2.9"
          }
        ]
      }
    }
  }
}

度量聚合

Metrics aggregation

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics.html

Metrics aggregations

Avg【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-avg-aggregation.html

平均值度量

  • 按照汽车颜色color划分,求价格平均值
GET /cars/_search
{
  "aggs" : { 
    "popular_colors" : { 
      "terms" : { 
        "field" : "color"
      },
      "aggs":{
          "avg_price": { 
             "avg": {
                "field": "price" 
             }
          }
      }
    }
  }
}
Cardinality【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-cardinality-aggregation.html

去重计数

POST /sms-logs-index/_search
{
  "aggs": {
    "agg": {
      "cardinality": {
        "field": "province"
      }
    }
  }
}
Extended stats【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-extendedstats-aggregation.html

查询指定Field的最大值,最小值,平均值,平方和等

POST /sms-logs-index/_search
{
  "aggs": {
    "agg": {
      "extended_stats": {
        "field": "fee"
      }
    }
  }
}

嵌套聚合【重点】

GET /cars/_search
{
    "aggs" : { 
        "popular_colors" : { 
            "terms" : { 
              "field" : "color"
            },
            "aggs":{
                "avg_price": { 
                   "avg": {
                      "field": "price" 
                   }
                },
                "maker":{
                    "terms":{
                        "field":"make"
                    }
                }
            }
        }
    }
}

过滤检索【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html

Query and filter context

  • query

    根据查询条件,计算文档的匹配度得到一个分数,根据分数排序,不做缓存处理。

  • filter

    根据查询条件查询文档,不计算分数,会对经常过滤的数据做缓存处理。

POST /sms-logs-index/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "corpName": "盒马鲜生"
          }
        },
        {
          "range": {
            "fee": {
              "lte": 4
            }
          }
        }
      ]
    }
  }
}

经纬度检索

Geo queries

Geo-distance【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-distance-query.html

距离搜索

POST /map/_search
{
  "query": {
    "geo_distance": {
      "location": {
        "lon": 116.433733,
        "lat": 39.908404
      },
      "distance": 3000,
      "distance_type": "arc"
    }
  }
}
  • location

    确定一个点

  • distance

    确定半径

  • distance_type

    指定形状为圆形

Geo-bounding box【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-bounding-box-query.html

方形搜索

POST /map/_search
{
  "query": {
    "geo_bounding_box": {
      "location": {
        "top_left": {
          "lon": 116.326943,
          "lat": 39.95499
        },
        "bottom_right": {
          "lon": 116.433446,
          "lat": 39.908737
        }
      }
    }
  }
}
  • top_left

    左上角

  • bottom_right

    右下角

Geo-polygon【了解】

https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-geo-polygon-query.html

多边形搜索

POST /map/_search
{
  "query": {
    "geo_polygon": {
      "location": {
        "points": [
          {
            "lon": 116.298916,
            "lat": 39.99878
          },
          {
            "lon": 116.29561,
            "lat": 39.972576
          },
          {
            "lon": 116.327661,
            "lat": 39.984739
          }
        ]
      }
    }
  }
}
  • points

指定多个点,确定一个多边形

根据检索删除文档

<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html>

POST /sms-logs-index/_delete_by_query
{
  "query": {
    "range": {
      "fee": {
        "lt": 4
      }
    }
  }
}

检索深入

高亮查询【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/highlighting.html

Highlighting

将关键字,以一定的特殊样式展示给用户

POST /sms-logs-index/_search
{
  "query": {
    "match": {
      "smsContent": "盒马"
    }
  },
  "highlight": {
    "fields": {
      "smsContent": {}
    },
    "pre_tags": "<font color='red'>",
    "post_tags": "</font>",
    "fragment_size": 10
  }
}
  • fragment_size

    指定高亮数据展示多少个字符回来。

  • pre_tags

    指定前缀

  • post_tags

    指定后缀

  • fields

    指定哪几个Field以高亮形式返回

分页查询【重点】

https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html

Paginate search results

POST /sms-logs-index/_search
{
  "from": 0,
  "size": 5,
  "query": {
    "term": {
      "province": {
        "value": "北京"
      }
    }
  }
}

深分页【重点】

ES对from + size是有限制的,from和size二者之和不能超过1W

原理:

from+size在ES查询数据的方式:

第一步现将用户指定的关键进行分词。 第二步将词汇去分词库中进行检索,得到多个文档的id。 第三步去各个分片中去拉取指定的数据。耗时较长。 第四步将数据根据score进行排序。耗时较长。 第五步根据from的值,将查询到的数据舍弃一部分。 第六步返回结果。

scroll+size在ES查询数据的方式:

第一步现将用户指定的关键进行分词。 第二步将词汇去分词库中进行检索,得到多个文档的id。 第三步将文档的id存放在一个ES的上下文中。 第四步根据你指定的size的个数去ES中检索指定个数的数据,拿完数据的文档id,会从上下文中移除。 第五步如果需要下一页数据,直接去ES的上下文中,找后续内容。 第六步循环第四步和第五步

深分页,不适合做实时查询

建立深分页

https://www.elastic.co/guide/en/elasticsearch/reference/current/scroll-api.html

POST /sms-logs-index/_search?scroll=1m
{
  "query": {
    "match_all": {}
  },
  "size": 2,
  "sort": [
    {
      "fee": {
        "order": "desc"
      }
    }
  ]
}

查询缓存分页数据

POST /_search/scroll
{
  "scroll_id": "scorll_id",
  "scroll": "<scorll信息的生存时间>"
}
参数
  • scroll

    默认情况下,不会超过1d

清除缓存分页数据

https://www.elastic.co/guide/en/elasticsearch/reference/current/clear-scroll-api.html

DELETE /_search/scroll/scroll_id

Spring Data Elasticsearch

https://spring.io/projects/spring-data#overview

Spring Data

Spring Data Elasticsearch是Spring Data项目下的一个子模块。

Spring Data的使命是为数据访问提供熟悉且一致的基于Spring的编程模型,同时仍保留底层数据存储的特殊特性。

它使得使用数据访问技术,关系数据库和非关系数据库,map-reduce框架和基于云的数据服务变得容易。这是一个总括项目,其中包含许多特定于给定数据库的子项目。这些令人兴奋的技术项目背后,是由许多公司和开发人员合作开发的。

Spring Data 的使命是给各种数据访问提供统一的编程接口,不管是关系型数据库(如MySQL),还是非关系数据库(如Redis),或者类似Elasticsearch这样的索引数据库。从而简化开发人员的代码,提高开发效率。

包含很多不同数据操作的模块:

Spring Data Elasticsearch

  • 支持 Spring 的基于@Configuration的 java 配置方式,或者 XML 配置方式
  • 提供了用于操作 ES 的便捷工具类**ElasticsearchTemplate**。包括实现文档到 POJO 之间的自动智能映射。
  • 利用 Spring 的数据转换服务实现的功能丰富的对象映射
  • 基于注解的元数据映射方式,而且可扩展以支持更多不同的数据格式
  • 根据持久层接口自动生成对应实现方法,无需人工编写基本操作代码(类似 mybatis,根据接口自动得到实现)。当然,也支持人工定制查询

快速入门

导入依赖

xml
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>

编写配置

  • application.yml
yml
spring:
  data:
    elasticsearch:
      client:
        reactive:
          endpoints: localhost:9300

添加Repository注解扫描

java
@SpringBootApplication
@EnableElasticsearchRepositories("com.futureweaver")
public class SpringBootStarter {
    public static void main(String[] args) throws IOException {
        SpringApplication.run(SpringBootStarter.class, args);
    }
}

编写实体类,添加注解

java
public class Item {
    Long id;
    String title; //标题
    String category;// 分类
    String brand; // 品牌
    Double price; // 价格
    String images; // 图片地址
}
  • @Document 作用在类,标记实体类为文档对象,一般有四个属性
    • indexName:对应索引库名称
    • type:对应在索引库中的类型
    • shards:分片数量,默认 5
    • replicas:副本数量,默认 1
  • @Id 作用在成员变量,标记一个字段作为 id 主键
  • @Field 作用在成员变量,标记为文档的字段,并指定字段映射属性:
    • type:字段类型,取值是枚举:FieldType
    • index:是否索引,布尔类型,默认是 true
    • store:是否存储,布尔类型,默认是 false
    • analyzer:分词器名称:ik_max_word
java
@Document(indexName = "item", shards = 1, replicas = 0)
public class Item {
    @Id
    private Long id;
    
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title; //标题
    
    @Field(type = FieldType.Keyword)
    private String category;// 分类
    
    @Field(type = FieldType.Keyword)
    private String brand; // 品牌
    
    @Field(type = FieldType.Double)
    private Double price; // 价格
    
    @Field(index = false, type = FieldType.Keyword)
    private String images; // 图片地址
}

文档操作

java
public interface ItemRepository extends ElasticsearchRepository<Item,Long> {
}

新增/修改文档

java
@Autowired
private ItemRepository itemRepository;

@Test
public void save() {
    Item item = new Item(1L, "小米10", " 手机", "小米", 3599.00, "https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1596073939.80384505.jpg");
    itemRepository.save(item);
}

批量新增文档

java
@Test
public void saveAll() {
    List<Item> list = new ArrayList<>();
    list.add(new Item(2L, "小米11", " 手机", "小米", 4299.00, "https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1609158771.91751022.jpg"));
    list.add(new Item(3L, "HUAWEI Mate 40 Pro", " 手机", "华为", 6999.00, "https://res.vmallres.com/pimages/detailImg/2020/11/16/3B2D22A8EBA5FA375C1FE5338353BFBCAFF5F40107641907.jpg"));
    itemRepository.saveAll(list);
}

查看文档

java
@Test
public void findById(){
    Optional<Item> optional = itemRepository.findById(1l);
    System.out.println(optional.get());
}

@Test
public void findAll(){
    // 查询全部,并按照价格降序排序
    Iterable<Item> items = itemRepository.findAll(Sort.by(Sort.Direction.DESC, "price"));
    items.forEach(item-> System.out.println(item));
}

自定义方法查询

Spring Data 的另一个强大功能,是根据方法名称自动实现功能。

比如:方法名做:findByTitle,SpringData 会自动根据语义,理解为: 根据 title 查询,无需实现。

Spring Data 中常见的语法:

KeywordSampleElasticsearch Query String
AndfindByNameAndPrice{"bool" : {"must" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}
OrfindByNameOrPrice{"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"price" : "?"}} ]}}
IsfindByName{"bool" : {"must" : {"field" : {"name" : "?"}}}}
NotfindByNameNot{"bool" : {"must_not" : {"field" : {"name" : "?"}}}}
BetweenfindByPriceBetween{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
LessThanEqualfindByPriceLessThan{"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
GreaterThanEqualfindByPriceGreaterThan{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}
BeforefindByPriceBefore{"bool" : {"must" : {"range" : {"price" : {"from" : null,"to" : ?,"include_lower" : true,"include_upper" : true}}}}}
AfterfindByPriceAfter{"bool" : {"must" : {"range" : {"price" : {"from" : ?,"to" : null,"include_lower" : true,"include_upper" : true}}}}}
LikefindByNameLike{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}
StartingWithfindByNameStartingWith{"bool" : {"must" : {"field" : {"name" : {"query" : "?*","analyze_wildcard" : true}}}}}
EndingWithfindByNameEndingWith{"bool" : {"must" : {"field" : {"name" : {"query" : "*?","analyze_wildcard" : true}}}}}
Contains/ContainingfindByNameContaining{"bool" : {"must" : {"field" : {"name" : {"query" : "**?**","analyze_wildcard" : true}}}}}
InfindByNameIn(Collection<String>names){"bool" : {"must" : {"bool" : {"should" : [ {"field" : {"name" : "?"}}, {"field" : {"name" : "?"}} ]}}}}
NotInfindByNameNotIn(Collection<String>names){"bool" : {"must_not" : {"bool" : {"should" : {"field" : {"name" : "?"}}}}}}
NearfindByStoreNearNot Supported Yet !
TruefindByAvailableTrue{"bool" : {"must" : {"field" : {"available" : true}}}}
FalsefindByAvailableFalse{"bool" : {"must" : {"field" : {"available" : false}}}}
OrderByfindByAvailableTrueOrderByNameDesc{"sort" : [{ "name" : {"order" : "desc"} }],"bool" : {"must" : {"field" : {"available" : true}}}}

例如,按照价格区间查询:

java
public interface ItemRepository extends ElasticsearchRepository<Item,Long> {

    /**
     * 根据价格区间查询
     * @param price1
     * @param price2
     * @return
     */
    List<Item> findByPriceBetween(double price1, double price2);
}
java
@Test
public void initData() {
    List<Item> list = new ArrayList<>();
    list.add(new Item(1L, "小米10", " 手机", "小米", 3599.00, "https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1596073939.80384505.jpg"));
    list.add(new Item(2L, "小米11", " 手机", "小米", 4299.00, "https://cdn.cnbj0.fds.api.mi-img.com/b2c-shopapi-pms/pms_1609158771.91751022.jpg"));
    list.add(new Item(3L, "HUAWEI Mate 40 Pro", " 手机", "华为", 6999.00, "https://res.vmallres.com/pimages/detailImg/2020/11/16/3B2D22A8EBA5FA375C1FE5338353BFBCAFF5F40107641907.jpg"));
    list.add(new Item(4L, "HUAWEI nova 8 Pro", "手机", "华为", 3999.00, "https://res.vmallres.com/pimages/detailImg/2020/12/22/88BDC878CA0CE62671DBF64976BBF597B92F5FD8A07670CD.jpg"));
    itemRepository.saveAll(list);
}
java
@Test
public void queryByPriceBetween(){
    List<Item> list = this.itemRepository.findByPriceBetween(2000.00, 4500.00);
    list.forEach(item-> System.out.println(item));
}

高级查询

基本查询

java
@Test
public void testQuery(){
    MatchQueryBuilder queryBuilder = QueryBuilders.matchQuery("title", "小米");
    Iterable<Item> items = this.itemRepository.search(queryBuilder);
    items.forEach(System.out::println);
}

自定义查询

NativeSearchQueryBuilder:Spring 提供的一个查询条件构建器,帮助构建 json 格式的请求体

java
@Test
public void testNativeQuery(){
    NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
    queryBuilder.withQuery(QueryBuilders.matchQuery("title", "小米"));
    Page<Item> items = this.itemRepository.search(queryBuilder.build());
    System.out.println(items.getTotalElements());
    System.out.println(items.getTotalPages());
    items.forEach(System.out::println);
}

分页查询

java
@Test
public void testNativeQuery(){
    NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
    queryBuilder.withQuery(QueryBuilders.termQuery("category", "手机"));

    // 分页
    int page = 0;
    int size = 3;
    queryBuilder.withPageable(PageRequest.of(page, size));

    Page<Item> items = this.itemRepository.search(queryBuilder.build());
    System.out.println(items.getTotalElements());
    System.out.println(items.getTotalPages());
    System.out.println(items.getSize());
    System.out.println(items.getNumber());
    items.forEach(System.out::println);
}

排序

java
@Test
public void testSort(){
    NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
    queryBuilder.withQuery(QueryBuilders.termQuery("category", "手机"));

    // 排序
    queryBuilder.withSort(SortBuilders.fieldSort("price").order(SortOrder.DESC));

    Page<Item> items = this.itemRepository.search(queryBuilder.build());
    System.out.println(items.getTotalElements());
    items.forEach(System.out::println);
}

聚合

聚合为桶

  • 按照品牌 brand 进行分组:
java
@Test
public void testAgg(){
    NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
    queryBuilder.withSourceFilter(new FetchSourceFilter(new String[]{""}, null));
    queryBuilder.addAggregation(AggregationBuilders.terms("brands").field("brand"));
    AggregatedPage<Item> aggPage = (AggregatedPage<Item>) this.itemRepository.search(queryBuilder.build());
    StringTerms agg = (StringTerms) aggPage.getAggregation("brands");
    List<StringTerms.Bucket> buckets = agg.getBuckets();
    for (StringTerms.Bucket bucket : buckets) {
        System.out.println(bucket.getKeyAsString());
        System.out.println(bucket.getDocCount());
    }
}

嵌套聚合,求平均值

java
@Test
public void testSubAgg(){
    NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
    queryBuilder.withSourceFilter(new FetchSourceFilter(new String[]{""}, null));
    queryBuilder.addAggregation(
        AggregationBuilders.terms("brands").field("brand")
        .subAggregation(AggregationBuilders.avg("priceAvg").field("price")) // 在品牌聚合桶内进行嵌套聚合,求平均值
    );
    AggregatedPage<Item> aggPage = (AggregatedPage<Item>) this.itemRepository.search(queryBuilder.build());
    StringTerms agg = (StringTerms) aggPage.getAggregation("brands");
    List<StringTerms.Bucket> buckets = agg.getBuckets();
    for (StringTerms.Bucket bucket : buckets) {
        System.out.println(bucket.getKeyAsString() + ",共" + bucket.getDocCount() + "台");

        InternalAvg avg = (InternalAvg) bucket.getAggregations().asMap().get("priceAvg");
        System.out.println("平均售价:" + avg.getValue());
    }
}

学习目标总结

  • 能够搭建 ElasticSearch 环境
  • 理解 ElasticSearch 的相关概念
  • 掌握 Elasticsearch 的索引操作
  • 掌握 Elasticsearch 的文档操作
  • 掌握 Elasticsearch 的检索操作
  • 掌握 Elasticsearch 的高亮查询
  • 掌握 Elasticsearch 的分页查询
  • 掌握 Elasticsearch 的深分页查询
  • 掌握 Spring Data Elasticsearch 框架的基本用法