首页 文章 精选 留言 我的

精选列表

搜索[es],共3894篇文章
优秀的个人博客,低调大师

ES设置字段搜索权重——Query-Time Boosting

Query-Time Boosting InPrioritizing Clauses, we explainedhow you could use theboostparameter at search time to give one query clause more importance than another. For instance: GET /_search { "query": { "bool": { "should": [ { "match": { "title": { "query": "quick brown fox", "boost": 2 } } }, { "match": { "content": "quick brown fox" } } ] } } } Thetitlequery clause is twice as important as thecontentquery clause, because it has been boosted by a factor of2. A query clause without aboostvalue has a neutral boost of1. 转自:https://www.elastic.co/guide/en/elasticsearch/guide/current/query-time-boosting.html 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6475896.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

ES使用org.elasticsearch.client.transport.NoNodeAvailableException: No no...

1) 端口错 client = new TransportClient().addTransportAddress(new InetSocketTransportAddress(ipAddress, 9300)); 这里9300 写成9200的话会No node available 要是你连的不是本机,注意IP有没有正确 2 )jar报引用版本不匹配,开启的服务是什么版本,引用的jar最好匹配(这个我没有去试,反正我的是匹配的) 3) 要是你改了集群名字,还有设置集群名字 Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "xxx").build(); client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(ipAddress, 9300)); 本文转自SummerChill博客园博客,原文链接:http://www.cnblogs.com/DreamDrive/p/6710158.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

ES使用脚本进行局部更新的排错记录

初学Elasticsearch,在按照《Elasticsearch服务器开发(第2版)》进行学习的过程中,在P17页中1.4.5 更新文档小节,使用脚本对文档进行局部更新的时候遇到了如下报错: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ~curl-XPOSThttp: //127 .0.0.1:9200 /blog/article/1/_update -d '{"script":"ctx._source.content=\"newcontent\""}' { "error" :{ "root_cause" :[{ "type" : "remote_transport_exception" , "reason" : "[LadyMandarin][127.0.0.1:9300][indices:data/write/update[s]]" } ], "type" : "illegal_argument_exception" , "reason" : "failedtoexecutescript" , "caused_by" :{ "type" : "script_exception" , "reason" : "scriptsoftype[inline],operation[update]andlang[groovy]aredisabled" }}, "status" :400 }% 我根据提示中的原因"scripts of type [inline], operation [update] and lang [groovy] are disabled"进行了查询,查到了官网文档关于对脚本更新的介绍(介绍链接)。 通过粗略查看文档,我发现要解决这个问题,需要在Elasticsearch的配置文件elasticsearch.yml中添加如下配置: script.engine.groovy.inline.update: on 由于Elasticsearch默认使用的是Groovy语言。Groovy语言一个快速且功能丰富的脚本语言,语法类似于Javascript。它在一个沙盒(sandbox)中运行,以防止恶意用户毁坏Elasticsearch或攻击服务器。 由于默认Elasticsearch没有打开Groovy的update权限,因此我们无法通过Groovy进行更新操作,通过上述配置打开权限之后,就可以进行更新操作了。 1 2 3 4 5 6 7 8 9 10 11 12 ~curl-XPOSThttp: //127 .0.0.1:9200 /blog/article/1/_update -d '{"script":"ctx._source.content=\"newcontent\""}' { "_index" : "blog" , "_type" : "article" , "_id" : "1" , "_version" :2, "_shards" :{ "total" :2, "successful" :1, "failed" :0 } }% 本文转自 aaao 51CTO博客,原文链接:http://blog.51cto.com/nolinux/1775232,如需转载请自行联系原作者

优秀的个人博客,低调大师

python统计ES存储空间占用的代码

import os from os.path import join, getsize def get_dir_size(dir, suffix_filter=None): size = 0L if not suffix_filter: for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, name)) for name in files]) else: pos = len(suffix_filter) for root, dirs, files in os.walk(dir): size += sum([getsize(join(root, name)) for name in files if name[-pos:] == suffix_filter]) return size if __name__ == "__main__": suffix = [".doc", ".pos", ".tim", ".tip", ".dvd", ".dvm", ".fdt", ".fdx", ".fnm", ".nvd", ".nvm"] sums = [0]*len(suffix) print "total size,", suffix all_size = 0.0 for i in range(0, 20): dir_name = r'D:\exp\elasticsearch-2.4.1\data\elasticsearch\nodes\metadata-dis-2017.05.17-192.168.10.5-93001\%d' % i total_size = get_dir_size(dir_name) all_size += total_size print total_size, ",", for index,f in enumerate(suffix): filesize = get_dir_size(dir_name, f) print filesize, if index != len(suffix)-1: print ",", sums[index] += filesize print "" print "sum:==>" print all_size, ",", sums print suffix, "==>" print "rate:",["{:6.4f}".format(sums[index]/all_size) for index,f in enumerate(suffix)], "other rate:", "{:6.4f}".format((all_size-sum(sums))/all_size) 结果: total size, ['.doc', '.pos', '.tim', '.tip', '.dvd', '.dvm', '.fdt', '.fdx', '.fnm', '.nvd', '.nvm'] 1317898783 , 151402808 , 49137369 , 301883415 , 4172214 , 141468778 , 2638 , 584778163 , 251283 , 14098 , 84785648 , 766 1322178937 , 151260397 , 49087934 , 301549945 , 4152932 , 141485775 , 2614 , 583980598 , 251572 , 14281 , 90390501 , 786 1319649899 , 151221470 , 49071207 , 301534617 , 4170120 , 140942980 , 2638 , 583509290 , 251019 , 14372 , 88929787 , 796 1314658083 , 151146248 , 49063654 , 301531446 , 4160809 , 140569823 , 2638 , 583241932 , 250572 , 14098 , 84674494 , 766 1320535933 , 151531650 , 49176093 , 302016964 , 4169422 , 141155952 , 2574 , 584516976 , 249055 , 14280 , 87700579 , 786 1320124857 , 151273971 , 49132333 , 301772358 , 4170596 , 141370180 , 2646 , 583164239 , 251026 , 14372 , 88970738 , 796 1316604607 , 151108604 , 49028330 , 301445032 , 4157849 , 140884622 , 2646 , 583674391 , 249567 , 14190 , 86036998 , 776 1318000530 , 151303288 , 49096354 , 301799237 , 4165775 , 141048755 , 2622 , 584203445 , 250668 , 14189 , 86113818 , 776 1319766874 , 151220609 , 49114923 , 301645769 , 4164351 , 141300148 , 2614 , 583120289 , 249195 , 14372 , 88932205 , 796 1316689373 , 151233222 , 49121429 , 301457255 , 4162316 , 141250414 , 2614 , 583262641 , 250656 , 14189 , 85932258 , 776 1318198716 , 151174674 , 49109038 , 301525947 , 4166291 , 140899847 , 2670 , 583598013 , 251472 , 14281 , 87454094 , 786 1320522076 , 151321339 , 49123177 , 301757750 , 4169815 , 141420824 , 2638 , 583468296 , 252283 , 14372 , 88989183 , 796 1319417975 , 151437201 , 49178363 , 301895414 , 4172117 , 140741668 , 2598 , 584117457 , 252773 , 14281 , 87603715 , 786 1317865422 , 151324795 , 49079342 , 301808126 , 4162318 , 141039688 , 2590 , 584047373 , 251114 , 14189 , 86133508 , 776 1319633778 , 151143225 , 49103608 , 301496485 , 4162216 , 140890300 , 2630 , 583678114 , 252802 , 14372 , 88887627 , 796 1317628208 , 151325819 , 49158454 , 301771482 , 4164837 , 141049094 , 2622 , 583762862 , 250401 , 14190 , 86126068 , 776 1318628784 , 151251125 , 49101866 , 301657775 , 4163649 , 140656991 , 2622 , 583999255 , 251506 , 14281 , 87527326 , 786 1316949748 , 151240013 , 49118487 , 301544994 , 4157729 , 140576588 , 2606 , 583907402 , 251325 , 14189 , 86134036 , 776 1316521884 , 151169612 , 49090142 , 301601874 , 4157814 , 140947297 , 2670 , 583231827 , 250762 , 14189 , 86053318 , 776 1319378726 , 151381023 , 49179677 , 301868523 , 4171265 , 140769513 , 2614 , 584110351 , 251400 , 14280 , 87627691 , 786 sum:==> 26370853193.0 , [3025471093L, 982271780L, 6033564408L, 83294435L, 2820469237L, 52504L, 11675372914L, 5020451L, 285065L, 1745003592L, 15660L] ['.doc', '.pos', '.tim', '.tip', '.dvd', '.dvm', '.fdt', '.fdx', '.fnm', '.nvd', '.nvm'] ==> rate: ['0.1147', '0.0372', '0.2288', '0.0032', '0.1070', '0.0000', '0.4427', '0.0002', '0.0000', '0.0662', '0.0000'] other rate: 0.0000 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/6932271.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

java api 调用es集群(1.7版本)

public static void main(String[] args) { Settings settings = ImmutableSettings.settingsBuilder() // client.transport.sniff=true // 客户端嗅探整个集群的状态,把集群中其它机器的ip地址自动添加到客户端中,并且自动发现新加入集群的机器 .put("client.transport.sniff", true).put("client", true)// 仅作为客户端连接 .put("data", false).put("cluster.name", "elasticsearch")// 集群名称 .build(); TransportClient client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("192.168.10.140", 9300))// TCP // 连接地址 .addTransportAddress(new InetSocketTransportAddress("192.168.10.124", 9300)); List<String> jsonData = BlogController.initData(); String json = "{" + "\"user\":\"金旭东\"," + "\"postDate\":\"2013-01-30\"," + "\"message\":\"测试elsaticsearch\"" + "}"; for (int i = 0; i < 1; i++) { IndexResponse response = client.prepareIndex("blog", "article").setSource(json).get(); if (response.isCreated()) { System.out.println("创建成功!"); } } client.close(); }

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

用户登录
用户注册