elastic-stack

ElasticSearch Java API to get distinct values from the Query Builders

孤者浪人 提交于 2020-08-10 22:55:33
问题 Am querying ElasticSearch using Java API and am getting lot of duplicate values. I want to get only the unique values from the query (distinct value). How can we get the distinct values from the Query Builder. Please find my java code below, which is giving duplicate values. QueryBuilder qb2=null; List<Integer> link_id_array=new ArrayList<Integer>(); for(Replacement link_id:linkIDList) { link_id_array.add(link_id.getLink_id()); } qb2 = QueryBuilders.boolQuery() .must(QueryBuilders.termsQuery(

ElasticSearch Java API to get distinct values from the Query Builders

别来无恙 提交于 2020-08-10 22:55:08
问题 Am querying ElasticSearch using Java API and am getting lot of duplicate values. I want to get only the unique values from the query (distinct value). How can we get the distinct values from the Query Builder. Please find my java code below, which is giving duplicate values. QueryBuilder qb2=null; List<Integer> link_id_array=new ArrayList<Integer>(); for(Replacement link_id:linkIDList) { link_id_array.add(link_id.getLink_id()); } qb2 = QueryBuilders.boolQuery() .must(QueryBuilders.termsQuery(

How to set hostname in global service in Docker Swarm

夙愿已清 提交于 2020-07-19 04:26:19
问题 I have a service deployed to my Docker Swarm Cluster as global service (ELK Metricbeat). I want to each of this service to have a hostname the same as the hostname of the running node (host)? in another word, how I can achieve the same result in the yml file such as: docker run -h `hostname` elastic/metricbeat:5.4.1 this is my yml file: metricbeat: image: elastic/metricbeat:5.4.1 command: metricbeat -e -c /etc/metricbeat/metricbeat.yml -system.hostfs=/hostfs hostname: '`hostname`' volumes: -

aggregate multiple recursive logstash

谁都会走 提交于 2020-07-10 10:28:15
问题 I am using logstash with input jdbc, and would like to embed one object inside another with aggregate. How can I use add recursive? Ie add an object inside another object? This would be an example: { "_index": "my-index", "_type": "test", "_id": "1", "_version": 1, "_score": 1, "_source": { "id": "1", "properties": { "nested_1": [ { "A": 0, "B": "true", "C": "PEREZ, MATIAS ROGELIO Y/O", "Nested_2": [ { "Z1": "true", "Z2": "99999" } }, { "A": 0, "B": "true", "C": "SALVADOR MATIAS ROMERO",

How to Store Distance value to SortValues or Entity

孤街浪徒 提交于 2020-05-17 05:44:20
问题 How to Store Distance value to SortValues or Entity using SDE4.0 @Query, and SearchHit "sort": [ { "_geo_distance" : { "codenames.geoLocation" : [ { "lat" : 32.846027, "lon" : -96.84987 } ], "unit" : "mi", "order" : "asc", } } ] 回答1: You have to add a Sort parameter t your repository query, see the documentation for Spring Data Elasticsearch 4 where this is described. In your case you'd need: Sort sort = Sort.by( new GeoDistanceOrder("geoLocation", new GeoPoint(32.846027, -96.84987))

ElasticSearch Aggregation + Sorting in on NonNumric Field 5.3

别说谁变了你拦得住时间么 提交于 2020-05-14 03:44:19
问题 I wanted to aggregate the data on a different field and also wanted to get the aggregated data on sorted fashion based on the name. My data is : { "_index": "testing-aggregation", "_type": "employee", "_id": "emp001_local000000000000001", "_score": 10.0, "_source": { "name": [ "Person 01" ], "groupbyid": [ "group0001" ], "ranking": [ "2.0" ] } }, { "_index": "testing-aggregation", "_type": "employee", "_id": "emp002_local000000000000001", "_score": 85146.375, "_source": { "name": [ "Person 02