Elasticsearch6.2.4-利用head插件创建索引

Elasticsearch6.2.4-利用head插件创建索引,第1张

Elasticsearch6.2.4-利用head插件创建索引。


1、启动Elasticsearch6.2.4服务

2、启动ElasticSearch head插件

cmd
cd head插件目录
grunt server

最好写一个bat文件,以便日后使用。


@echo off
rem 这个符号表示该行是注释。


rem 需要修改盘符和cd到对应的head插件目录 d: cd D:\工作\elasticsearch\elasticsearch-head-master grunt server echo Job is done

浏览器访问http://localhost:9100/ 效果如下图(里面图内包含了我的测试数据,如果是第一次启动不会有数据)

Elasticsearch6.2.4-利用head插件创建索引,第2张

3、创建索引

在head插件的符合查询内写入相应的创建语句即可。


以下是我的mapping,mapping结构要与要导入的数据库字段一致。


Mapping规则请参考?https://www.cnblogs.com/dxf813/p/8447467.html 比较详细

{
  "settings": {
    "index.number_of_shards": 1,
    "index.number_of_replicas": 0,
    "index.refresh_interval": "-1"
  },
  "mappings": {
    "cql_article": {
      "properties": {
        "journal_title": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word",
          "fielddata": true,
          "fields": {
            "raw": {
              "type": "keyword"
            }
          }
        },
        "journal_volumn": {
          "type": "text"
        },
        "title": {
          "type": "text",
          "analyzer": "ik_max_word",
          "search_analyzer": "ik_max_word",
          "boost": 1.5
        },
        "author": {
          "type": "text"
        },
        "begin_page": {
          "type": "integer",
          "index": false
        },
        "end_page": {
          "type": "integer",
          "index": false
        },
        "publish_date": {
          "type": "date",
          "format": "yyyy-MM-dd HH:mm:ss"
        },
        "publisher": {
          "type": "text"
        }
      }
    }
  }
}

Elasticsearch6.2.4-利用head插件创建索引,第3张

提交请求后返回

{
"acknowledged": true,
"shards_acknowledged": true,
"index": "cql_article"
}

这样索引就创建完成啦!如果您是第一次接触ElasticSearch,可以参考?

https://blog.csdn.net/laoyang360/article/details/51931981

截取wojiushiwo987大神部分博客内容以做留存

 

ES Restful API GET、POST、PUT、DELETE、HEAD含义:?

1)GET:获取请求对象的当前状态。


?

2)POST:改变对象的当前状态。


?

3)PUT:创建一个对象。


?

4)DELETE:销毁对象。


?

5)HEAD:请求获取对象的基础信息。


Mysql与Elasticsearch核心概念对比示意图?

Elasticsearch6.2.4-利用head插件创建索引,第4张

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/zaji/538612.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2019-08-15
下一篇 2019-08-15

发表评论

登录后才能评论

评论列表(0条)

保存