ES简介

2019-12-13  本文已影响0人  箭飞天

ES是什么

应用企业

应用场景

原理

ES原理

Analysis (分析器)

通过执行 analyzer 实现,analyzer包含 Character filter,Tokenizer, Token filter(有序经过上述三步处理). 
更多查看

Character filter (字符过滤器)

Tokenizer (分词器)

Token filter (标记过滤器)

Token filter 从 Tokenizer 获得terms,可对terms执行的操作有,其操作对象是单个的term:

demo

POST _analyze
{
  "tokenizer": "standard",
  "text": "<p>I&apos;m so <b>happy</b>!</p>"
}

POST _analyze
{
  "tokenizer": "standard",
  "char_filter": [
    "html_strip"
  ],
  "text": "<p>I&apos;m so <b>happy</b>!</p>"
}

POST _analyze
{
  "tokenizer": "keyword",
  "char_filter": [
    "html_strip"
  ],
  "text": "<p>I&apos;m so <b>happy</b>!</p>"
}

POST _analyze
{
  "tokenizer": "letter",
  "text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}

POST _analyze
{
  "tokenizer": "standard",
  "filter":  [ "lowercase", "asciifolding" ],
  "text":      "Is This Déja vu?"
}

点击演示

主要名词介绍

主要操作流程

选举Master

写操作

读操作

数据操作路逻辑

配置

相关API

易出问题的点

分页问题

由于lucene的原因,所有数据会做扁平化出来

{
        "followers":    [
                   {    "age":    35,    "name":    "Mary    White"},
                   {    "age":    26,    "name":    "Alex    Jones"},
                   {    "age":    19,    "name":    "Lisa    Smith"}
        ]
}
{
        "followers.age":    [19,    26,    35],
         "followers.name":   [alex,    jones,    lisa,    smith,    mary,    white]
}

ES和Lucene相关概念对比

加载测试数据

{"index":{"_id":"1"}}
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
curl -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_bulk?pretty&refresh" --data-binary "@accounts.json"
curl "localhost:9200/_cat/indices?v"

相关概念

相关文档

上一篇 下一篇

猜你喜欢

热点阅读