索引

搜索

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. maven导出项目依赖的jar包

    摘要: 在进行项目部署时,需要将maven项目所依赖的jar导出到指定目录,本文讲解如何导出项目依赖的jar包 一.导出到默认目录 targed/dependency 从Maven项目中导出项目依赖的 ...

  2. Python使用PIL模块生成随机验证码

    PIL模块的安装 pip3 install pillow 生成随机验证码图片 import random from PIL import Image, ImageDraw, ImageFont fro ...

  3. paddle实践

    Docker image阅读:https://github.com/PaddlePaddle/book/blob/develop/README.cn.md docker run -d -p 8888: ...

  4. shell脚本-预定义常量

    $0 这个程式的执行名字$n 这个程式的第n个参数值,n=1..9$* 这个程式的所有参数,此选项参数可超过9个.$# 这个程式的参数个数$$ 这个程式的PID(脚本运行的当前进程ID号)$! 执行上 ...

  5. [LeetCode&Python] Problem 860. Lemonade Change

    At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you, and ...

  6. CH0101 a^b、 CH0102 64位整数乘法(快速幂、快速乘)【模板题】

    题目链接:传送门    //a^b   传送门    //64位整数乘法 题目: 描述 求 a 的 b 次方对 p 取模的值,其中 ≤a,b,p≤^ 输入格式 三个用空格隔开的整数a,b和p. 输出格 ...

  7. lesson2-cnn-fastai

    %mkdir的做法glob('.jpg')np.random.permutation(图片)np.random.rename(,)#save_array:utils中,连接每个btch得到的数组#ke ...

  8. 并发编程-TPL

    并发编程-TPL 本节导航 基本概念 并发编程 TPL 线程基础 windows为什么要支持线程 线程开销 CPU的发展 使用线程的理由 如何写一个简单Parallel.For循环 数据并行 Para ...

  9. C++学习(三)(C语言部分)之 基本数据类型

    基本数据类型 上期回顾 stdlib.h system,命令release MT导入ico文件 基本数据类型 整数 int浮点型(小数 实型) float double字符型 char 变量 常量速度 ...

  10. 将koa+vue部署到服务器

    很久很久以前,就对前后端如何分离,后端如何把代码部署到服务器有浓厚的兴趣,最近在阿里云上申请了一个服务器,试试水吧! 本文参考了文章<基于Node的Koa2项目从创建到打包到云服务器指南> ...