ElasticSearch

急~为啥我指定的的maven依赖版本没有生效?不是最短路径原则吗?

我们两清 提交于 2021-01-29 12:42:21
女朋友他们项目用了 spring-boot ,以 spring-boot-parent 作为 parent: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.9</version> </parent> 女朋友最近想用 elasticsearch 作为搜索引擎,在项目中添加了依赖 <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>7.10.2</version> </dependency> 写好代码,一跑,报类不存在异常: java.lang.NoClassDefFoundError: org/elasticsearch/common/xcontent/DeprecationHandler at com.lv.springboot.datasource.ClientUTis.main(ClientUTis.java:13) Caused by: java.lang.ClassNotFoundException: org.elasticsearch

How to store info regarding which notifications have been read by user?

梦想与她 提交于 2021-01-29 11:55:30
问题 I have a set of notification or information items stored in elasticsearch. Once a user has seen a notification I need to mark it as seen by that user. A user can filter documents by read/unread status. Notifications will be viewed by lot of users and seen status will constantly get updated. What is the best way to store this data. Shall I store the list of users which have seen that notification in same document itself or shall I create parent child relationship. 回答1: For sure you should

Elasticsearch: scroll between specified time frame

回眸只為那壹抹淺笑 提交于 2021-01-29 10:32:18
问题 I have some data in elasticsearch. as shown in the image I used below link example to do the scrolling https://gist.github.com/drorata/146ce50807d16fd4a6aa page = es.search( index = INDEX_NAME, scroll = '1m', size = 1000, body={"query": {"match_all": {}}}) sid = page['_scroll_id'] scroll_size = page['hits']['total'] # Start scrolling print( "Scrolling...") while (scroll_size > 0): print("Page: ",count) page = es.scroll(scroll_id = sid, scroll = '10m') # Update the scroll ID sid = page['

can I filter an array in elastic?

寵の児 提交于 2021-01-29 10:10:10
问题 I had to insert a huge amount of data into elastic and I have done it in the following manner. I need to query this object but I am unable to filter the "logData" array. Can someone help me out here ? is it even possible to filter an array in elastic? "_source":{ "FileName": "fileName.log" "logData": [ { "LineNumber": 1, "Data": "data1" }, { "LineNumber": 2, "Data": "Data2" }, { "LineNumber": 3, "Data": "Data3" }, { "LineNumber": 4, "Data": "Data4" }, { "LineNumber": 5, "Data": "Data5" }, {

Complex Nested Query Where to Place Bool Match

独自空忆成欢 提交于 2021-01-29 09:22:26
问题 I have a complex index within Elastic that I need to query by 3 parameters. Thanks to this answered question I am able to query by 2 of the 3 parameters, however the 3rd parameter is not at the same nested level as the other two. The schema looks this.. The following query works for the 2 of the 3 parameters... But the 3rd parameter is at a different level the the other two so this query does not return the expected document. Given that the bool match query for "boundedContexts.aggregateRoot

Can we avoid mapping all the fields to entity class in springdata for elasticsearch, as I have more than 100 field in the json document?

早过忘川 提交于 2021-01-29 09:13:13
问题 I am implementing a spring-boot microservice for elasticsearch (es) operations using springdata APIs. My documents that are indexed in es are huge with multiple fields (more than 100). Is there a way to avoid defining/hardcoding all the fields in the entity class for elasticsearch object in java? My sample patient JSON could be like: { "key_1":"value_1", "key_2":"value_2", "key_3":"value_3", . . . "key_n":"value_n" } 回答1: If you can go for a slightly different form to store your data in

Searchkick word_start match with nested field

∥☆過路亽.° 提交于 2021-01-29 09:05:49
问题 I have a Rails app with searchkick gem. My model has a nested JSON field. I try to make it searchable with word_start match. When I set in explicitly like: class Post < ApplicationRecord searchkick word_start: [:nested_data_field] end I does not work, and I get error: {"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [nested_data_field]", "caused_by"=>{"type"=>"illegal_state_exception", "reason"=>"Can't get text on a START_OBJECT at 1:401"}} on item with id '2596' How can I make

Get all the buckets for a aggregate elastic search

天大地大妈咪最大 提交于 2021-01-29 09:01:54
问题 I want to get all the buckets available for a particular aggregate. Is there any query or endpoint to get the buckets? Below is my Mapping. If I query with any filter then the related buckets are coming up, but I want all the buckets to show it on the frontend to have or operations. Example: If we have 2 records, one is with category as chair and the other is in the table. If I select a chair it is returning table count is zero but it should show as table count as 1. So user can select both.

Setup network access for Elasticsearch on Ubuntu running on parallels

若如初见. 提交于 2021-01-29 08:53:09
问题 I have an instance of ubuntu server running version 20.04 installed on parallels on a Mac however I am unable to access it from other devices on my network, only from the instance of ubuntu. lsb_release -a gives the following result No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal I have installed Elasticsearch version 7.6.2 from the APT repository using the instructions here I can run curl -X GET 'http://localhost:9200' on

In Kabana can you create a line chart from a custom aggregation?

眉间皱痕 提交于 2021-01-29 08:51:03
问题 I have a nested aggregation which returns data like: "aggregations" : { "builds" : { "buckets" : [ { "key" : 1610145879928, "key_as_string" : "2021-01-08T22:44:39.928Z", "total_duration_parent" : { "total_duration_ms" : { "value" : 3515.0 } } }, { "key" : 1610146149159, "key_as_string" : "2021-01-08T22:49:09.159Z", "total_duration_parent" : { "total_duration_ms" : { "value" : 6206.0 } } }, { "key" : 1610146149564, "key_as_string" : "2021-01-08T22:49:09.564Z", "total_duration_parent" : {