lucene和es总结
一、首先介绍lucene涉及到的排序过程

1.1、如何自定义排序对象
你可以自定义collector对象;
亦可以自定义comparator对象;
可以自定义scoredoc对象,决定如何处理结果集合;
1.2、这几种自定义之间有何区别?
自定义collector和comparator有什么区别呢????????
Besides building your own Collector to customize how the results are stored and sorted, another way to customize results sorting is to implement your own FieldComparator for SortField. Note that this customization only deals with the sorting aspect of the result set; it does not give you the flexibility to filter out results, as you would have with Collector.
二、ES master slave介绍
master es中的作用就是:it’s the responsability of the master node to allocate the shards equally among the nodes.
requests分为两种:index requests和 search requests;两种请求可以落到集群任何一台机器。
》》然后对于TransportClient本身就是做的round robin形式,
The TransportClient connects remotely to an elasticsearch cluster using the transport module. It does not join the cluster, but simply gets one or more initial transport addresses and communicates with them in round robin fashion on each action
所以你只需要new的时候给定 addresses就好了
private TransportClient client=null;
Settings settings = Settings.settingsBuilder().put("cluster.name", cluster_name).build();
client = TransportClient.builder().settings(settings).build() ;
for(String host_port:host_ports.split(",")){
String[] hostAndPort=host_port.split(":");
if(hostAndPort.length==2){
String host=hostAndPort[0].trim();
int port=Integer.valueOf(hostAndPort[1].trim());
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(host), port));
}
}
而其中的配置文件可以是
cluster.name: cluster_name
host.ports: ip1:9300,ip2:9300,ip3:9300
>>对于client的关闭主要是三部曲
client.close();
client.threadPool().shutdown();
client = null;
这个坑的解释是https://discuss.elastic.co/t/correct-way-to-use-transportclient-connection-object/17947/8
三、参考文献
http://blog.trifork.com/2013/10/24/how-to-avoid-the-split-brain-problem-in-elasticsearch/
lucene和es总结的更多相关文章
- Lucene、ES好文章
1.lucene4.5源码分析系列:lucene概述 http://blog.csdn.net/liweisnake/article/details/10348969 http://www.cnblo ...
- ElasticSearch:Lucene和ElasticSearch
Lucene的概念: 关于索引 索引(index)和搜索(搜索),在lucene以及es里面索引是一个动作,即插入动作,包括创建索引以及为索引添加文档:所有则是针对索引(添加)的文档按照评分规则进行查 ...
- es知识点
版权声明:本文为博主原创文章,未经博主允许不得转载.转载请务必加上原作者:铭毅天下,原文地址:blog.csdn.net/laoyang360 https://blog.csdn.net/wojius ...
- ElasticSearch入门篇Ⅰ --- ES核心知识概括
C01.什么是Elasticsearch 1.什么是搜索 垂直搜索(站内搜索) 互联网的搜索:电商网站,招聘网站,各种app IT系统的搜索:OA软件,办公自动化软件,会议管理,员工管理,后台管理系 ...
- 【Elasticsearch 技术分享】—— 十张图带大家看懂 ES 原理 !明白为什么说:ES 是准实时的!
前言 说到 Elasticsearch ,其中最明显的一个特点就是 near real-time 准实时 -- 当文档存储在Elasticsearch中时,将在1秒内以几乎实时的方式对其进行索引和完全 ...
- 用Jenkins配置自动化构建
公司培训内容 -------------->记一笔 dubbo 微服务soadiamond-server 配置中心kafka rocketmq消息队列cas-server 单点登录spring ...
- 1.ElasticSearch介绍及基本概念
一.ElasticSearch介绍 一个采用RESTful API标准的高扩展性的和高可用性的实时性分析的全文搜索工具 基于Lucene[开源的搜索引擎框架]构建 ElasticSearch是一个面向 ...
- 【转】Elasticsearch学习
原作者:铭毅天下,原文地址:blog.csdn.net/laoyang360 https://blog.csdn.net/wojiushiwo987/article/details/52244917 ...
- Elasticsearch简介和安装对比
各位小伙伴,又到了本期分享大数据技术的时间,本次给大伙带来的是Elasticsearch这个技术,闲话不多聊,我们开始进入正题. 一.什么是elasticsearch Elasticsearch是一个 ...
随机推荐
- javaSE基础04
javaSE基础04 一.三木运算符 <表达式1> ? <表达式2> : <表达式3> "?"运算符的含义是: 先求表达式1的值, 如果为真, ...
- [转]阿里巴巴数据库连接池 druid配置详解
一.背景 java程序很大一部分要操作数据库,为了提高性能操作数据库的时候,又不得不使用数据库连接池.数据库连接池有很多选择,c3p.dhcp.proxool等,druid作为一名后起之秀,凭借其出色 ...
- 泛型T的类型获取
T.getClass()或者T.class都是非法的,因为T是泛型变量. 由于一个类的类型是什么是在编译期处理的,故不能在运行时直接在Base里得到T的实际类型. /** * 可以在service层直 ...
- centos7.0 安装redis集群
生产环境下redis基本上都是用的集群,毕竟单机版随时都可能挂掉,风险太大.这里我就来搭建一个基本的redis集群,功能够用但是还需要完善,当然如果有钱可以去阿里云买云数据库Redis版的,那个还是很 ...
- 记一次proc_open没有开启心得感悟
引言: 今天在部署服务器的时候,使用composer来安装依赖.遇到了 The Process class relies on proc_open, which is not available on ...
- Centos7 关闭防火墙(转)
转载地址:http://www.cnblogs.com/silent2012/archive/2015/07/28/4682770.html CentOS 7.0默认使用的是firewall作为防火墙 ...
- Breakpad Google的crash捕获、抓取开源库
简介: Breadpad为google chrominum项目下用于处理dump的一套工具:内部采用跨平台方式实现捕获.生成.解析与平台无关的dump,便于统一处理:支持进程内与进程外捕获,当为进程外 ...
- Duilib源码分析(四)绘制管理器—CPaintManagerUI—(前期准备一)
上节中提到在遍历创建控件树后,执行了以下操作: 1. CDialogBuilder构建各控件对象并形成控件树,并返回第一个控件对象pRoot: 2. m_pm.AttachDialo ...
- JS实现常用排序算法—经典的轮子值得再造
关于排序算法的博客何止千千万了,也不多一个轮子,那我就斗胆粗制滥造个轮子吧!下面的排序算法未作说明默认是从小到大排序. 1.快速排序2.归并排序3.冒泡排序4.选择排序(简单选择排序)5.插入排序(直 ...
- XmlValidationHelper XSD、Schema(XmlSchemaSet)、XmlReader(XmlValidationSettings)、XmlDocument、XDocument Validate
namespace Test { using Microshaoft; using System; using System.Xml; using System.Xml.Linq; class Pro ...