ES学习总结

1.创建索引

put localhost:9200/person

2.添加数据

put  localhost:9200/person/_doc/1

{
"first_name" : "John",
"last_name" : "Smith",
"age": 25,
"about" : "I love to go rock climbing",
"interests" : ["sports","music"]
}

3.搜索ES里面的数据

get localhost:9200/person/_doc/1

GET _all  : 查看所有

GET /index名/_doc(默认的type,6版本以后可省略)/id : 根据id查

根据指定条件查询:

should=or

must=and

match=like

POST /person/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "last_name": "Smith"
          }
        },
        {
          "match": {
            "about": "basketball"
          }
        }
      ]
    }
  }
}

启动logstash 

bin/logstash -f config/mysql.conf

添加和更新文档

POST test/job/1
{
"becif": "612",
"uuid": "vprcBisp"
}

查询分词效果:

POST http://127.0.0.1:9200/_analyze?pretty=true

{
    "analyzer":"standard",
    "text": "我是程序员"
}
原文地址:https://www.cnblogs.com/gylhaut/p/15312612.html