aggregation

Elasticsearch aggregation order by top hit score

陌路散爱 提交于 2019-12-09 05:24:55
问题 I want to order buckets by doc.score of top_hit. My current implementation is below. group_by_iid: { terms: { field: 'iid', order: { max_score: 'desc' }, size: 0 }, aggs: { max_score: { max: { script: 'doc.score' } }, top_hit: { top_hits: { sort: [{ source_priority: { order: 'desc' } }], size: 1 } } } } This is wrong because buckets are ordered by their top score, not their top source_priority document's score. Is there a way to solve this problem? 回答1: I had the same issue, and the way I

elasticsearch - Aggregation returns terms in key , but not the complete field, how can I get full field returned?

只谈情不闲聊 提交于 2019-12-09 04:10:23
问题 In the elasticsearch implementation , I have few simple aggregations on the basis of few fields as shown below - "aggs" : { "author" : { "terms" : { "field" : "author" , "size": 20, "order" : { "_term" : "asc" } } }, "title" : { "terms" : { "field" : "title" , "size": 20 } }, "contentType" : { "terms" : { "field" : "docType" , "size": 20 } } } The aggregations work fine and I get the results accordingly. but the title key field returned (or any other field - multi word) , has single word

django aggregation to lower resolution using grouping by a date range

孤人 提交于 2019-12-09 03:23:23
问题 horrible title, but let me explain: i've got this django model containing a timestamp (date) and the attribute to log - f.e. the number of users consuming some ressource - (value). class Viewers(models.Model): date = models.DateTimeField() value = models.IntegerField() for each 10seconds the table contains the number of users. something like this: | date | value | |------|-------| | t1 | 15 | | t2 | 18 | | t3 | 27 | | t4 | 25 | | .. | .. | | t30 | 38 | | t31 | 36 | | .. | .. | now i want to

ArangoDB Faceted Search Performance

纵然是瞬间 提交于 2019-12-08 19:36:31
问题 We are evaluating ArangoDB performance in space of facets calculations. There are number of other products capable of doing the same, either via special API or query language: MarkLogic Facets ElasticSearch Aggregations Solr Faceting etc We understand, there is no special API in Arango to calculate factes explicitly. But in reality, it is not needed, thanks for a comprehensive AQL it can be easily achieved via simple query, like: FOR a in Asset COLLECT attr = a.attribute1 INTO g RETURN {

How to display an aggregation of an object that is connected to another object?

北战南征 提交于 2019-12-08 18:27:25
I've set up these 2 objects : Book Author A book has an author field. I have one action : Read I have 2 aggregations : Recently read books Favorite authors The Favorite authors aggregation is set up to show author objects on the read action. I posted a story to my Timeline: Felipe read "some book" , but it only shows the Recently read books aggregation and not the Favorite authors . How am I suppose to set up the aggregation for Favorite authors ? If the aggregation is setup correctly (you can test this by adding sample objects and actions in the aggregation configuration) then it will show up

I merge two different payloads into one payload

两盒软妹~` 提交于 2019-12-08 12:30:49
问题 I have two different payloads here in format: {"addressLine1":"POSBUS 007","addressLine3":"-1","postalCode":"1200"} {"email":"xxxx@xxx.net"}. If I use the scatter gather i get the following payload: [{"addressLine1":"POSBUS 007","addressLine3":"-1","postalCode":"1200"}, {"email":"xxxx@xxx.net"}] But what I want to do is merge those two payloads into one payload like for instance: {"addressLine1":"POSBUS 007","addressLine3":"-1","postalCode":"1200", "email":"xxxx@xxx.net"} 回答1: There are

Spotfire - Finding Percentage of Subtotals

馋奶兔 提交于 2019-12-08 06:51:16
问题 I'm trying to turn a cross table that looks like this into a table which shows the subtotals and percentage over each Group like the example below Where the percentage is the sales of each product divided by the total sales in each group, so for Product A = 20 / (20+40+30) = 22% So far, I've managed to use Spotfire built-in subtotal function and the following expression to almost achieved the table I want Sum([Sales) / Sum([Sales]) OVER (Intersect(Parent([Axis.Rows]),All([Axis.Rows]))) but

Do pointer/reference data members indicate an association or aggregaation relationship in UML?

自作多情 提交于 2019-12-08 06:36:15
问题 I'm a bit confused about which one it is. You could say it 'uses' the object via the pointer - therefore association. But it also sounds like aggregation - 'has an' object but when this object dies that doesn't mean the referenced object dies. Which one makes most sense in UML? 回答1: It can indicate association, aggregation and event composition. The difference between the three is semantic and not static or implementation specific. If the pointed class has a lifecycle dependency with the

How to display an aggregation of an object that is connected to another object?

大憨熊 提交于 2019-12-08 05:37:54
问题 I've set up these 2 objects : Book Author A book has an author field. I have one action : Read I have 2 aggregations : Recently read books Favorite authors The Favorite authors aggregation is set up to show author objects on the read action. I posted a story to my Timeline: Felipe read "some book" , but it only shows the Recently read books aggregation and not the Favorite authors . How am I suppose to set up the aggregation for Favorite authors ? 回答1: If the aggregation is setup correctly

elasticsearch aggregation to sort by ratio of aggregations

这一生的挚爱 提交于 2019-12-07 11:56:49
问题 I have a scenario in analytics where I want to calculate least performing 20 outlets out of 1000+ outlets where performance = transactionCount/ VisitCount per month at an outlet. Mappings are, { "CustomerVisit": { "properties": { "outlet": { "type": "string", "index": "not_analyzed" }, "customerName": { "type": "string", "index": "not_analyzed" }, "visitMonth": { "type": "Date" }, "visit": { "type": "nested", "properties": { "visitStatus": { "type": "long" }, "transactionStatus": { "type":