1、搜索引擎知识和搜索框架elasticsearch基本介绍
     简介:通过京东电商 介绍什么是搜索引擎,和开源搜索框架ElasticSearch6.x新特性介绍

前言:介绍ES的主要特点和使用场景,新特性讲解
         mysql:like 模糊,性能问题,

solr:针对企业,Lucene
         elasticsearch:针对数据量特别大,PB,TB
           纯java开发,springboot使用,5.6版本
           es升级4->5版本,改动大,但是5版本后,改动不大

elasticSearch主要特点

1、特点:全文检索,结构化检索,数据统计、分析,接近实时处理,分布式搜索(可部署数百台服务器),处理PB级别的数据
             搜索纠错,自动完成
         2、使用场景:日志搜索,数据聚合,数据监控,报表统计分析
        
         3、国内外使用者:维基百科,Stack Overflow,GitHub

新特性讲解
    
         1、6.2.x版本基于Lucene 7.x,更快,性能进一步提升,对应的序列化组件,升级到Jackson 2.8
             mysql:database   table   rocord
             es   : index      type(只能存在一个)    document

2、推荐使用5.0版本推出的Java REST/HTTP客户端,依赖少,比Transport使用更方便,在基准测试中,性能并不输于Transport客户端,

在5.0到6.0版本中,每次有对应的API更新, 文档中也说明,推荐使用这种方式进行开发使用,所有可用节点间的负载均衡
         在节点故障和特定响应代码的情况下进行故障转移,失败的连接处罚(失败的节点是否重试取决于失败的连续次数;失败的失败次数越多,客户端在再次尝试同一节点之前等待的时间越长)
        
         3、(重要)不再支持一个索引库里面多个type,6.x版本已经禁止一个index里面多个type,所以一个index索引库只能存在1个type

官方文档:
         1、6.0更新特性
          https://www.elastic.co/guide/en/elasticsearch/reference/6.0/release-notes-6.0.0.html#breaking-java-6.0.0
         2、6.1更新特性
         https://www.elastic.co/guide/en/elasticsearch/reference/6.1/release-notes-6.1.0.html

2、快熟部署ElastcSearch5.6.x
     简介:讲解为什么不用ES6.x版本,及本地快速安装ElasticSeach和场景问题处理
        
     配置JDK1.8
         使用wget 下载elasticsearch安装包
         wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.8.tar.gz
     解压
         tar -zxvf elasticsearch-5.6.8.tar.gz
     官网:https://www.elastic.co/products/elasticsearch
    
     外网访问配置:   
         config目录下面elasticsearch.yml
         修改为 network.host: 0.0.0.0

配置es出现相关问题处理(阿里云、腾讯云,亚马逊云安装问题集合):
         1、问题一
             Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)
             #
             # There is insufficient memory for the Java Runtime Environment to continue.
             # Native memory allocation (mmap) failed to map 986513408 bytes for committing reserved memory.
             # An error report file with more information is saved as:
             # /usr/local/software/temp/elasticsearch-6.2.2/hs_err_pid1912.log
         解决:内存不够,购买阿里云的机器可以动态增加内存

2、问题二
             [root@iZwz95j86y235aroi85ht0Z bin]# ./elasticsearch
             [2018-02-22T20:14:04,870][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
             org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
             at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-6.2.2.jar:6.2.2]
             at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.2.jar:6.2.2]
             at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.2.jar:6.2.2]
             at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.2.jar:6.2.2]
         解决:用非root用户
             添加用户:useradd -m 用户名  然后设置密码  passwd 用户名

3、问题三
             ./elasticsearch
             Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/software/temp/elasticsearch-6.2.2/config/jvm.options
            解决:权限不够 chmod 777 -R 当前es目录

常见配置问题资料:https://www.jianshu.com/p/c5d6ec0f35e0

  Windows环境使用教程:

  将zip文件解压进入 elasticsearch-xx\bin 目录,双击执行 elasticsearch.bat,该脚本文件执行 ElasticSearch 安装程序,稍等片刻,打开浏览器,输入 http://localhost:9200 ,显式以下画面,说明ES安装成功。

  

3、ElasticSearch5.6.8测试数据准备
     简介: ElasticSearch5.6.x简单测试
         1、步骤 https://www.elastic.co/guide/en/elasticsearch/reference/5.6/index.html
         2、使用POSTMAN 工具

基础
             查看集群状态:localhost:9200/_cat/health?v
             查看索引列表:localhost:9200/_cat/indices?v

4、SpringBoot2.x整合elasticsearch5.6.x
     简介:SpringBoot2.x整合elasticSearch5.6.8实战

Spring Data Elasticsearch文档地址
         https://docs.spring.io/spring-data/elasticsearch/docs/3.0.6.RELEASE/reference/html/

版本说明:SpringBoot整合elasticsearch
             https://github.com/spring-projects/spring-data-elasticsearch/wiki/Spring-Data-Elasticsearch---Spring-Boot---version-matrix

1、添加maven依赖                   
             <dependency> 
                <groupId>org.springframework.boot</groupId> 
                <artifactId>spring-boot-starter-data-elasticsearch</artifactId> 
            </dependency>

2、接口继承ElasticSearchRepository,里面有很多默认实现
             注意点:
                  索引名称记得小写,类属性名称也要小写
              新建实体对象article
              加上类注解 @Document(indexName = "blog", type = "article")

3、配置文件:
              # ELASTICSEARCH (ElasticsearchProperties)
             spring.data.elasticsearch.cluster-name=elasticsearch # Elasticsearch cluster name.
             spring.data.elasticsearch.cluster-nodes=localhost:9300 # Comma-separated list of cluster node addresses.
             spring.data.elasticsearch.repositories.enabled=true # Whether to enable Elasticsearch repositories.

4、QueryBuilder使用
         https://www.elastic.co/guide/en/elasticsearch/client/java-api/1.3/query-dsl-queries.html
        
         //单个匹配,搜索name为jack的文档 
         QueryBuilder queryBuilder = QueryBuilders.matchQuery("title", "搜");

4、查看es数据

查看索引信息:http://localhost:9200/_cat/indices?v

    

查看某个索引库结构:http://localhost:9200/blog

  

查看某个对象:http://localhost:9200/blog/article/1

12章 搜索框架ElasticSearch介绍和整合SpringBoot 4节课的更多相关文章

  1. 【SpringBoot】搜索框架ElasticSearch介绍和整合SpringBoot

    ========================12章 搜索框架ElasticSearch介绍和整合SpringBoot ============================= 加入小D课堂技术交 ...

  2. jQuery系列 第一章 jQuery框架简单介绍

    第一章 jQuery框架简单介绍 1.1 jQuery简介 jQuery是一款优秀的javaScript库(框架),该框架凭借简洁的语法和跨平台的兼容性,极大的简化了开发人员对HTML文档,DOM,事 ...

  3. 11、Logback日志框架介绍和SpringBoot整合实战 2节课

    1.新日志框架LogBack介绍     简介:日志介绍和新日志框架Logback讲解 1.常用处理java的日志组件 slf4j,log4j,logback,common-logging 等     ...

  4. JS读书心得:《JavaScript框架设计》——第12章 异步处理

    一.何为异步   执行任务的过程可以被分为发起和执行两个部分. 同步执行模式:任务发起后必须等待直到任务执行完成并返回结果后,才会执行下一个任务. 异步执行模式:任务发起后不等待任务执行完成,而是马上 ...

  5. 十九种Elasticsearch字符串搜索方式终极介绍

    前言 刚开始接触Elasticsearch的时候被Elasticsearch的搜索功能搞得晕头转向,每次想在Kibana里面查询某个字段的时候,查出来的结果经常不是自己想要的,然而又不知道问题出在了哪 ...

  6. 【STM32H7教程】第12章 STM32H7的HAL库框架设计学习

    完整教程下载地址:http://forum.armfly.com/forum.php?mod=viewthread&tid=86980 第12章       STM32H7的HAL库框架设计学 ...

  7. 第12章 Reference-RIL运行框架

    Reference-RIL完成两部分处理逻辑: 与LibRIL交互完成RIL消息的处理. 与Modem通信模块交互完成AT命令的执行. Reference-RIL的运行机制 主要涉及以下几个方面: R ...

  8. Linux就这个范儿 第12章 一个网络一个世界

    Linux就这个范儿 第12章 一个网络一个世界 与Linux有缘相识还得从一项开发任务说起.十八年前,我在Nucleus  OS上开发无线网桥AP,需要加入STP生成树协议(SpanningTree ...

  9. Hadoop专业解决方案-第12章 为Hadoop应用构建企业级的安全解决方案

    一.前言: 非常感谢Hadoop专业解决方案群:313702010,兄弟们的大力支持,在此说一声辛苦了,春节期间,项目进度有所延迟,不过元宵节以后大家已经步入正轨, 目前第12章 为Hadoop应用构 ...

随机推荐

  1. BZOJ2008 JSOI2010连通数(floyd+bitset)

    一直不明白为什么要用floyd求传递闭包,直接搜不是更快嘛……不过其实可以用bitset优化,方法也比较显然.bitset是真的神奇啊,好多01状态且转移相似的东西都可以用这个优化一下. #inclu ...

  2. BZOJ4785 ZJOI2017树状数组(概率+二维线段树)

    可以发现这个写挂的树状数组求的是后缀和.find(r)-find(l-1)在模2意义下实际上查询的是l-1~r-1的和,而本来要查询的是l~r的和.也就是说,若结果正确,则a[l-1]=a[r](mo ...

  3. C# 枚举值 (二) 多属性 操作

    很多时候,我们的枚举值可能需要中英文, 那么可以使用下面的方法: 下面这个类,包含2部分. 1 BaseDescriptionAttribute特性的重载 2 枚举的操作类 EnumOperate n ...

  4. Educational Codeforces Round 3 C. Load Balancing

    C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  5. [USACO 2018 Open Contest]作业总结

    t1-Out of Sorts 题目大意 将最大的数冒泡排序到最后需要多少次操作. 分析 排序后判断距离. ac代码 #include<bits/stdc++.h> #define N 1 ...

  6. Elasticsearch 常见问题的解决思路

    本文为es性能监控基础的扩展,大家可以先看下性能监控基础,熟悉下es的基本原理.为翻译性质文档,感谢原作者,原始文档地址 类似于汽车的运行方式,Elasticsearch旨在让用户快速上手和运行,而无 ...

  7. DownloadProvider 源码详细分析

    DownloadProvider 简介 DownloadProvider 是Android提供的DownloadManager的增强版,亮点是支持断点下载,提供了“开始下载”,“暂停下载”,“重新下载 ...

  8. FFMEPG -- A ffmpeg and SDL Tutorial : tutorial05

    修改了同步播放ffmpeg问题.并且增加可以放大视频. // tutorial05.c // A pedagogical video player that really works! // // C ...

  9. VB|xp风格:终于解决了“图片优化软件”在部分xp系统上无法启动的问题。

    一年以来,图片优化软件一直存在一个“兼容”性问题. 因为之前的软件是在windows 2003系统上开发的,制作成安装文件后,经部分用户测试发现,在部分用户的xp系统上安装后,无法正常启动,只能听到p ...

  10. 解决FLASH遮住层的问题 IE,Firefox都适用!

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://down ...