Tag: elasticsearch

如何在Spring-data-elasticsearch中启用查询日志记录

我使用spring-data-elasticsearch框架从elasticsearch服务器获取查询结果,java代码如下: SearchQuery searchQuery = new NativeSearchQueryBuilder() .withQuery(matchAllQuery()).withSearchType(SearchType.COUNT) .addAggregation(new MinBuilder(“min_createDate”).field(“createDate”)) .build(); List list = template.queryForList(searchQuery, Entity.class); 虽然我怎么知道发送到elasticssearch服务器的原始http查询? 如何启用日志记录,我尝试添加log4j,但似乎spring-data-elasticsearch不记录查询。

Elasticsearch:在测试类路径中发现jar地狱

我想在Elasticsearch中执行unit testing,因为我正在使用Java-test-framework 我正在使用Elasticsearch-1.6.0并参考这些链接以获取帮助https://www.elastic.co/guide/en/elasticsearch/reference/1.6/using-elasticsearch-test-classes.html https:// github。 COM /弹性/ elasticsearch / BLOB /主/核心/ src目录/测试/ JAVA /组织/ elasticsearch /动作/搜索/ SearchRequestBuilderTests.java 这是代码 class CampaignESTest extends ESTestCase { def getCLient():MockTransportClient={ val settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), Files.createTempDir().toString()) .build(); val client = new MockTransportClient(settings); client } } class CampaignTestSearch extends PlaySpec{ val client=new CampaignESTest val response = client.prepareSearch(“dbtest”) .setTypes(CAMPAIGN_COLLECTION_NAME) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .addFields(“uuid”,”campaignName”,”artworkID”,”activationDate”,”_source”) .setQuery(query) […]

如何使用ElasticSearch和Flashlight查询Firebase?

当我使用带有Firebase的Flashlight和带有直接查询的弹性搜索时,它确实有效: 询问 {“index”:”firebase”,”query”:”rose”,”type”:”tasting”} 码 … Map q = new HashMap(); q.put(“index”, “firebase”); q.put(“type”, “tasting”); q.put(“query”, “rose”); String key = ref.child(“request”).push().getKey(); ref.child(“request”).child(key).setValue(q); … 但是当我想要不仅限于10个提示时,这个失败了(没有结果) 询问 {“index”:”firebase”,”options”:{“from”:0,”to”:50},”query”:{“query_string”:{“query”:”rose”}},”type”:”tasting”} 码 … HashMap q = new HashMap(); q.put(“query”, “rose”); qs = new HashMap(); qs.put(“query_string”, q); Map options = new HashMap(); options.put(“from”, 0); options.put(“to”, 50); HashMap qo = new HashMap(); qo.put(“index”, […]

Elasticsearch 5如何开始编写本机Java插件

我目前正在尝试编写一个Elasticsearch插件(主要用于测试目的),我正在努力处理简单说明的文档 : 这些示例提供了入门所需的简单骨骼。 有关如何编写插件的更多信息,我们建议您查看本文档中列出的插件以获取灵感。 所以基本上,在找到一些教程(除了maven部分之外哪种不同意)之后,请参阅http://david.pilato.fr/blog/2016/07/27/creating-a-plugin-for-elasticsearch -5-dot-0-using-maven /和http://jfarrell.github.io (它们不inheritance相同的类)。 我实际上被困在哪里开始,核心elasticsearch依赖项中有哪些组件可用,以及我应该如何加载我的插件。 (我知道我可以通过测试和复古工程来调查它,我只是想知道是否有人有关于这个主题的好建议)。 现在我的代码看起来像: public class MyPlugin extends Plugin implements NativeScriptFactory{ //overriden methods } 我应该去哪里? 非常感谢你!

使用java api在Elasticsearch中创建索引和添加映射会丢失分析器错误

代码在Scala中。 它与Java代码非常相似。 我们的地图索引器用于创建索引的代码: https : //gist.github.com/a16e5946b67c​​6d12b2b8 上述代码用于创建索引和映射的实用程序: https : //gist.github.com/4f88033204cd761abec0 java给出的错误: https : //gist.github.com/d6c835233e2b606a7074 运行代码并获取错误后对http://elasticsearch.domain/maps/_settings的响应: https ://gist.github.com/06ca7112ce1b01de3944 JSON文件: https : //gist.github.com/bbab15d699137f04ad87 https://gist.github.com/73222e300be9fffd6380 附件是我正在加载的json文件。我已经确认它正在加载正确的json文件并正确地将它作为字符串输出到.loadFromSource和.setSource。 任何想法为什么即使它们在设置中也找不到分析仪? 如果我通过curl运行这些json文件,它们工作正常并正确设置映射。

使用Java API从Elasticsearch获取所有记录

我试图使用Java API从Elasticsearch获取所有记录。 但我收到以下错误 n [[Wild Thing] [localhost:9300] [indices:data / read / search [phase / dfs]]]; 嵌套:QueryPhaseExecutionException [结果窗口太大,+大小必须小于或等于:[10000]但是[10101]。 我的代码如下 Client client; try { client = TransportClient.builder().build(). addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(“localhost”), 9300)); int from = 1; int to = 100; while (from 0) { for (SearchHit searchData : response.getHits().getHits()) { JSONObject value = new JSONObject(searchData.getSource()); System.out.println(value.toString()); } } } […]

ElasticSearch Java API的异步性质

想为elasticSearch服务编写集成测试: 1.指数 2.搜索 3.检查结果 每个Java api方法都是异步执行的。 如何将其设为简单的同步api:call api.a ,等待结果,调用api.b ,等待结果…

Elasticsearch – EdgeNgram + highlight + term_vector =错误的亮点

当我使用带有edgengram的分析器(min = 3,max = 7,front)+ term_vector = with_positions_offsets 使用text =“CouchDB”的文档 当我搜索“couc”时 我的亮点是“cou”而不是“couc” 似乎我的亮点仅在于最小匹配标记“cou”,而我期望在确切的标记(如果可能)或至少找到最长的标记。 它使用term_vector = with_positions_offsets分析文本时工作正常 删除term_vector = with_positions_offsets的性能有什么影响?

Elasticsearch安装:错误’jvm.dll错过’服务器’JVM

下载了elasticsearch并按照此链接中的步骤解压缩后: 在Windows上安装Elastic Search 我收到以下错误: Error: missing ‘server’ JVM at ‘C:\Program Files (x86)\Java\jre1.8.0_131\bin\server\jvm.dll’. Please install or use the JRE or JDK that contains these missing components. 注意:我还必须按照此解决方案的建议安装JDK8 我应该更改.config文件中的内容吗? 也许这一行? # force the server VM (remove on 32-bit client JVMs) -server

喜欢在Elasticsearch中搜索

我正在使用elasticsearch来过滤和搜索json文件,我是这项技术的新手。 所以我有点困惑如何在elasticsearch中编写类似查询。 select * from table_name where ‘field_name’ like ‘a%’ 这是mysql查询。 如何在Elasticsearch中编写此查询? 我使用的是elasticsearch版本0.90.7。