elasticsearch运维相关

扩展程序加载elasticsearch-head_v0.1.4

 

 

Kibana配置

 

server.port: 5601

server.host: "192.168.32.17"

elasticsearch.hosts: ["http://***:***"]

elasticsearch.username: "***"

elasticsearch.password: "***"

 

kibana的后台启动

nohup ./kibana >> /opt/kibana.log 2>&1 &

 

http://192.168.32.17:5601/app/kibana

 

 

Java High Level REST Client 

https://www.elastic.co/guide/en/elasticsearch/client/java-rest/6.7/java-rest-high-supported-apis.html

 

阿里云客户端实例

https://help.aliyun.com/document_detail/121359.html?spm=a2c4g.11186623.4.1.6af2bd30gUl4tq

 

keyword 与 text 映射类型的区别

将 book 字段设置为 keyword 映射 (只能精准查询, 不能分词查询,能聚合、排序)

POST /es_db/student/_search

{

    "query": {

       "term": {

          "book": "elasticSearch入门至精通"

                }

              }

}

将 book 字段设置为 text 映射 (能模糊查询, 能分词查询,不能聚合、排序)

POST /es_db/student/_search

{

    "query": {

       "match": {

           "book": "elasticSearch入门至精通"

                 }

           }

}

索引建立

POST /es_db/_mapping/student

       {

           "student":{

              "properties":{

                 "name":{

                      "type":"keyword"

                 },

                 "sex":{

                     "type":"integer"

                 },

                 "age":{

                     "type":"integer"

                 },

                 "book":{

                     "type":"text",

                     "analyzer":"ik_smart",

                     "search_analyzer":"ik_smart"

                 },

                 "address":{

                     "type":"text",

                     "analyzer":"ik_smart",

                     "search_analyzer":"ik_smart"

                 }

              }

           }

       }

分词分析

GET _analyze

{

  "analyzer": "ik_smart",

  "text": "中华人民共和国人民大会堂"

 }





  GET _analyze

{

  "analyzer": "ik_max_word",

  "text": "中华人民共和国人民大会堂"

 }

          

分词检索分析


PUT /es_db/student/1

           {

              "name": "Jack",

              "sex": 1,

              "age": 25,

              "book": "java入门至精通",

              "address": "广州小蛮腰"

           }

java入门至精通:java、入门、至、精通



##无法查到

POST /es_db/student/_search

       {

           "query": {

              "match": {

                  "book": "入"

              }

           }

       }





##可以查到

POST /es_db/student/_search

{

    "query": {

       "match": {

           "book": "入门"

           }

       }

}



##可以查到

POST /es_db/student/_search

{

    "query": {

       "match": {

           "book": "至"

           }

       }

}



#可以查到

POST /es_db/student/_search

{

    "query": {

       "match": {

           "book": "入门精通" 

              }

           }

}



#可以查到

POST /es_db/student/_search

{

    "query": {

       "match": {

           "book": "入门至精通"

              }

           }

}

Ik分词器在阿里云的配置

https://help.aliyun.com/document_detail/137928.html?spm=a2c4g.11186623.6.601.5a47104elzPfoo

index_not_found_exception的解决

出现index_not_found_exception错误的解决方式,建立该索引,然后继续运行

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值