索引

搜索

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. 2017-2018-2 20165228 实验二《Java面向对象程序设计》实验报告

    2017-2018-2 20165228 实验二<Java面向对象程序设计>实验报告 相关知识点 三种代码 伪代码:注释,与具体编程语言无关 产品代码:由伪代码翻译而来的具体编程语言语法相 ...

  2. 复杂的动态布尔表达式性能评估(1)--Antlr4实现

    前言: 规则引擎中, 往往涉及到多个条件构成了复杂布尔表达式的计算. 对于这类布尔表达式, 一是动态可变的(取决于运营人员的设定), 二是其表达式往往很复杂. 如何快速的计算其表达式的值, 该系列文章 ...

  3. c++函数参数类型-引用、指针、值

    c++函数参数类型-引用.指针.值 https://www.cnblogs.com/lidabo/archive/2012/05/30/2525837.html

  4. EF数据库配置

    <?xml version="1.0" encoding="utf-8"?> <configuration> <configSec ...

  5. SyntaxError: Non-UTF-8 code starting with '\xe5' in file ***.py on line 105, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for

    用charles抓包时, 对抓到的html,放到pycharm中解析, 结果报错: SyntaxError: Non-UTF-8 code starting with '\xe5' in file * ...

  6. HDU2023:求平均成绩

    Problem Description 假设一个班有n(n<=50)个学生,每人考m(m<=5)门课,求每个学生的平均成绩和每门课的平均成绩,并输出各科成绩均大于等于平均成绩的学生数量. ...

  7. $.each $.map $.filter 区别 Script

    $('section.required').each(function () { var type = $(this).attr('data-type'); if (type == 'MULTIPLE ...

  8. sourcetree删除github远程仓库文件

    sourcetree删除远程仓库的master分支文件步骤 第一步:删除本地远程仓库分支的所需要文件或者文件夹(本地和远程仓库同步) 第二步:回到sourcetree提交,推送 第三步:刷新远程仓库

  9. CentOS7.1 KVM虚拟化之环境准备

    备注:实验没有问题,只是暂时还不知道弄这个用来干嘛,不过先留着以后查看吧 一.基础平台 1.一台装有VMware的Windows系统 (可联网) 2.CentOS7.1 64bit 镜像 二.最小化安 ...

  10. Exclude the folders/files for indexing

    如果你的项目有非常多的文件,目录,Eclipse 有一个很好的Resource Filter 可以把有某些特征的文件,目录不再进行索引.