索引

搜索

mapping

分词器

1.创建索引

http://192.168.65.131:9200/smartom_index

2.查看索引:

http://192.168.65.131:9200/_cat/indices?v

3.插入数据【这样也就是说创建了一个文档为users】

http://192.168.65.131:9200/smartom_index/users/101
{
"name":"smartom",
"age":19
}

4.精确搜索

http://192.168.65.131:9200/smartom_index/_search?q=name:smartom

5.全词搜索

http://192.168.65.131:9200/smartom_index/_search

全文索引

6.全词搜索 term

term是代表完全匹配,即不进行分词器分析,文档中必须包含整个搜索的词汇

GET smartom_index/users/_search
{
"query":{
"term":{
"name":{
"value":"smartom"
}
}
}
}

7.全词搜索 match 全文搜索查询

分词查询

GET smartom_index/users/_search
{
"query": {
"match": {
"name": "我是smartom你是谁"
}
}
}

分词器analyze

8.创建一个分词器

POST _analyze
{
"analyzer":"standard",
"text":"我是smartom你是谁"
}

standard

simple


过滤器 标记器 [去掉]

9. 一个标记器【filter?】

POST _analyze
{
"tokenizer":"lowercase",
"text":"SMARTOM"
}

也可以 在tokenizer里面写 standard

10.一个过滤器:

POST _analyze
{
"tokenizer": "standard",
"filter": ["lowercase"],
"text": "我是smartom你是谁"
}

11.字符过滤器:[过滤html代码]

POST _analyze
{
"tokenizer": "standard",
"char_filter": ["html_strip"],
"text": "woshi<br><b>asdf</b>是"
}

11.停用词

13.创建一个过滤器:settings analysis analyzer 【在索引里面用来进行搜索】

PUT smartom
{
"settings": {
"analysis": {
"analyzer": {
"smartom-analyer":{
"type":"custom",
"tokenizer":"standard",
"char_filter":["html_strip"],
"filter":["lowercase"]
}
}
}
}
}

14.创建仓库:

前提指定repo路径 elasticsearch.yml

path.repo: ["/tmp/esbak"]

PUT _snapshot/mybackup
{
"type": "fs",
"settings": {
"location": "/tmp/esbak"
}
}

15.备份索引:

bak1 是备份名称 smartom_index 备份的索引名称

PUT _snapshot/mybackup/bak1?wait_for_completion=true
{
"indices": "smartom_index"
}

16.删除索引

DELETE smartom_index

17.关闭索引

POST smartom_index/_close

18.恢复索引

POST _snapshot/mybackup/bak1/_restore?wait_for_completion=true
{
"indices": "smartom_index"
}

19.查看当前插件

GET _cat/plugins

20.查看mapping当前文档 查看文档字段类型?

GET smartom_index/_mappings

21.创建mapping

[刚创建的时候]

POST /smartom_index/fulltext/_mapping
{
"properties": {
"content": {
"type": "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_max_word"
}
}
}

需要导入和导出数据

删除数据之后

title 用ik分词器进行索引

PUT smartom_index
{
"mappings": {
"news":{
"properties": {
"title": {
"type":"text",
"analyzer": "ik_max_word"
}
}
}
}
}

22.修改文档中的类型?

PUT smartom_index/_mapping/users
{
"properties": {
"news": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}

23.搜索建议

一:elasticsearch常用操作总结的更多相关文章

  1. ElasticSearch常用操作

    查看某个INDEX库某个TYPE表,某个字段的分词结果  GET /${index}/${type}/${id}/_termvectors?fields=${fields_name}http://19 ...

  2. Elasticsearch本地环境安装和常用操作

    本篇文章首发于我的头条号Elasticsearch本地环境安装和常用操作,欢迎关注我的头条号和微信公众号"大数据技术和人工智能"(微信搜索bigdata_ai_tech)获取更多干 ...

  3. Elasticsearch(ES)API 增删查改常用操作

    常用操作 查询所有数据 POST http://192.168.97.173:27009/logstash_test_2018/doc/_search { "query": { & ...

  4. ElasticSearch 集群基本概念及常用操作汇总(建议收藏)

    内容来源于本人的印象笔记,简单汇总后发布到博客上,供大家需要时参考使用. 原创声明:作者:Arnold.zhao 博客园地址:https://www.cnblogs.com/zh94 目录: Elas ...

  5. elasticsearch使用操作部分

    本片文章记录了elasticsearch概念.特点.集群.插件.API使用方法. 1.elasticsearch的概念及特点.概念:elasticsearch是一个基于lucene的搜索服务器.luc ...

  6. Elasticsearch 常用API

    1.   Elasticsearch 常用API 1.1.数据输入与输出 1.1.1.Elasticsearch 文档   #在 Elasticsearch 中,术语 文档 有着特定的含义.它是指最顶 ...

  7. 【三】用Markdown写blog的常用操作

    本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...

  8. php模拟数据库常用操作效果

    test.php <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); ...

  9. Mac OS X常用操作入门指南

    前两天入手一个Macbook air,在装软件过程中摸索了一些基本操作,现就常用操作进行总结, 1关于触控板: 按下(不区分左右)            =鼠标左键 control+按下        ...

随机推荐

  1. ES6 函数的扩展-rest参数

    ES6 引入 rest 参数(形式为...变量名),用于获取函数的多余参数,这样就不需要使用arguments对象了.rest 参数搭配的变量是一个数组,该变量将多余的参数放入数组中. functio ...

  2. FZU 1759-Super A^B mod C

    传送门:http://acm.fzu.edu.cn/problem.php?pid=1759 Accept: 1161    Submit: 3892Time Limit: 1000 mSec     ...

  3. 安卓 dex 通用脱壳技术研究(四)

    /*     当第一个类执行到此函数时,我们在dvmDefineClass执行之前,也就是第一个类加载之前     注入我们的dump代码:即DumpClass()函数 */ static void  ...

  4. ss linux终端配置

    最近ss莫名宕机,懒得重新安装了,就安装了一个非gui版本,安装非gui版本还有一个优点就是在远程服务器的时候可以用proxychains进行终端代理,非常友好实用.下面简单的说一下如何进行终端ss ...

  5. 在城市后面加上省,市,区 以及将MySQL入库脚本封装成class

    在城市后面加省,市,区时,使用过滤器和for循环,if判断 一起使用.   自定义一个过滤器 def my_detail(val):                                  ...

  6. python学习1 ---range()函数

    奇怪的现象 在paython3中 print(range(10)) 得出的结果是 range(0,10) ,而不是[0,1,2,3,4,5,6,7,8,9] ,为什么呢? 官网原话: In many ...

  7. loadrunner如何对mysql进行增删改查

    libraries.zip  地址:链接:https://pan.baidu.com/s/1kIZ2aBCOFSJ9l727MxgIKQ 密码:40vq *   说明一下,因为 lr 有很多库文件都没 ...

  8. 牛客国庆集训派对Day1-C:Utawarerumono(数学)

    链接:https://www.nowcoder.com/acm/contest/201/C 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 1048576K,其他语言20 ...

  9. Windows下的matplotlib画图中文显示设置

    一.在测试matplotlib时遇到X轴中文字符不显示的问题,参考网上 源代码如下 from matplotlib import pyplot as plt import random import ...

  10. c# 敏捷2 ForEach ToDictionary ToLookup Except比较

    using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; ...