1、注意问题、es和redis同时使用会报错

解决:

package com.bw;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
//import lombok.extern.slf4j.Slf4j;
//@Slf4j
@Component
public class ElasticSearchConfiguration implements InitializingBean {
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ElasticSearchConfiguration.class);
static {
System.setProperty("es.set.netty.runtime.available.processors", "false");
}
@Override
public void afterPropertiesSet() throws Exception {
log.info("*****************es_config*************************");
log.info("es.set.netty.runtime.available.processors:{}",
System.getProperty("es.set.netty.runtime.available.processors"));
log.info("***************************************************");
}
}

2、就2个注解,2个属性

package com.bw.entity;

import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
@Document(indexName = "week",type = "week02")
public class Student {
@Id
private String sid;
private String sname;
private String pwd;
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getSname() {
return sname;
}
public void setSname(String sname) {
this.sname = sname;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public Student() {
super();
// TODO Auto-generated constructor stub
}
public Student(String sid, String sname, String pwd) {
this.sid = sid;
this.sname = sname;
this.pwd = pwd;
}
@Override
public String toString() {
return "Student [sid=" + sid + ", sname=" + sname + ", pwd=" + pwd + "]";
} }

配置

server:
port: 9007 spring:
application:
name: tensquare‐search #指定服务名
data:
elasticsearch:
cluster-nodes: 127.0.0.1:9300

依赖

<!--   es的依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>

8、2 es数据库的使用的更多相关文章

  1. Python-将json文件写入ES数据库

    1.安装Elasticsearch数据库 PS:在此之前需首先安装Java SE环境 下载elasticsearch-6.5.2版本,进入/elasticsearch-6.5.2/bin目录,双击执行 ...

  2. ES数据库重建索引——Reindex(数据迁移)

    应用背景: 1.当你的数据量过大,而你的索引最初创建的分片数量不足,导致数据入库较慢的情况,此时需要扩大分片的数量,此时可以尝试使用Reindex. 2.当数据的mapping需要修改,但是大量的数据 ...

  3. 5、1 es 数据库和mysql 数据库同步 (Windows操作系统)

    (1)在logstash-5.6.8安装目录下创建文件夹mysqletc (名称随意) (2)文件夹下创建mysql.conf (名称随意) ,内容如下: input { jdbc { #sc表 jd ...

  4. ES数据库搜索

    1.倒排索引 1.倒排索引和正向索引 在全文搜索里,文档数据离不开搜索,而搜索离不开索引(没有索引搜索会很低效),倒排索引(Inverted index)是全文搜索系统里最高效的索引方法和数据结构,E ...

  5. 初识ES数据库

    一.什么是Elasticsearch 1.概念以及特点 1.Elasticsearch和MongoDB/Redis/Memcache一样,是非关系型数据库. 是一个接近实时的搜索平台,从索引这个文档到 ...

  6. es数据库基本操作

    1.es建立索引: curl -XPUT 'http://10.xx.xx.xx:9200/索引名称' 2.es查询所有索引: curl -XGET 'http://10.xx.xx.xx:9200/ ...

  7. ES数据库高可用配置

    ES高可用集群部署 1.ES高可用架构图 2.创建ES用户组 1.Elasticsearch不能在 root 用户下启动,我们需要在三台机器上分创建一个普通用户# 创建elastic用户 userad ...

  8. ES数据库 常用 java api

    一.获取类api get API允许根据其id从索引中获取类型化的JSON文档. 以下示例从名为twitter的索引中获取一个JSON文档,该索引名为tweet,id值为1: GetResponse ...

  9. 分布式数据库对比评测(Es,mongodb,redis)基础知识篇

    前言 我建议大家看下这个,否则后面你不知道我在说什么. 1.ES数据库相关概念 啥是Es,说白了就是支持文档搜索的分布式数据库,专门方便搜索的,GITHUB京东现在都在用. 1.ES的数据库存放在哪里 ...

随机推荐

  1. java代码操作word模板并生成PDF

    这个博客自己现在没时间写,等后面有时间了,自己再写. 这中需求是在实际的项目开发中是会经常遇到的. 下面我们先从简单入手一步一步开始. 1.首先,使用word创建一个6行两列的表格. 点击插入-6行2 ...

  2. 调用图灵API V2 遇到的坑

    1:遇到的第一个问题:跨域 解决办法: 第一种:使用query中的jsonp 可惜图灵要求post方法,而jsonp,只能使用get方法,才能跨域,失败 第二种:服务器添加header,可是我怎么去改 ...

  3. [后端]gitlab之gitlab-ci自动部署

    转发:https://www.jianshu.com/p/df433633816b 简介 gitlab-ci全称是gitlab continuous integration的意思,也就是持续集成.中心 ...

  4. 查看.NET应用程序中的异常(下)

    为什么要使用内存转储进行调试? 在两种主要情况下,您可能需要使用内存转储进行调试.第一种情况是应用程序有一个未处理的异常并崩溃,而您只有一个内存转储.第二种情况是,在生产环境中出现异常或特定行为,并且 ...

  5. 一篇来自hasura graphql-engine 百万级别live query 的实践

    转自:https://github.com/hasura/graphql-engine/blob/master/architecture/live-queries.md Scaling to 1 mi ...

  6. Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

    Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because ...

  7. .NET API Gateway Ocelot 介绍

    项目:https://github.com/ThreeMammals/Ocelot  Windows (AppVeyor)  Linux & OSX (Travis)  Windows  Ma ...

  8. 70: libreoj #2424 区间dp

    $des$ $sol$ $f_{i, j, k} => a => [1, i], b => [1, j], a_i = b_j | a_i != b_j , a_i => 0 ...

  9. 微信小程序电影模板

    [外链图片转存失败(img-STw401rR-1565101469846)(https://upload-images.jianshu.io/upload_images/11158618-52efd0 ...

  10. 升级项目版本:SpringBoot1.5.x到SpringBoot2.0.x

    1.升级版本的选择 首先去spring的官网看一下最新的版本与版本之间的依赖