aggregation

Elasticsearch terms aggregation by strings in an array

可紊 提交于 2019-12-03 10:26:50
How can I write an Elasticsearch terms aggregation that splits the buckets by the entire term rather than individual tokens? For example, I would like to aggregate by state, but the following returns new, york, jersey and california as individual buckets, not New York and New Jersey and California as the buckets as expected: curl -XPOST "http://localhost:9200/my_index/_search" -d' { "aggs" : { "states" : { "terms" : { "field" : "states", "size": 10 } } } }' My use case is like the one described here https://www.elastic.co/guide/en/elasticsearch/guide/current/aggregations-and-analysis.html with

Application log aggregation, management and notifications [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-03 05:15:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm wondering what everyone is using for logging, log management and log aggregation on their systems. I am working in a company which uses .NET for all it's applications and all systems are Windows based. Currently each application looks after its own logging and notifications of failures (e.g. if app A fails

Client-Side Dynamic Removal of <script> Tags in <head>

丶灬走出姿态 提交于 2019-12-03 03:47:31
问题 Is it possible to remove script tags in the <head> of an HTML document client-side and prior to execution of those tags? On the server-side I am able to insert a <script> above all other <script> tags in the <head> , except one, and I would like to be able to remove all subsequent scripts. I do not have the ability to remove <script> tags from the server side. What I've tried: (function (c,h) { var i, s = h.getElementsByTagName('script'); c.log("Num scripts: " + s.length); i = s.length - 1;

How to count in coredata (aggregation)?

半世苍凉 提交于 2019-12-03 03:29:35
I am learning core data and particularly working on aggregation. Current what I want to do : count the number of records from the table which is in to-many relationship with inverse relationship on some criteria . Currently I am doing this : NSExpression *ex = [NSExpression expressionForFunction:@"count:" arguments:[NSArray arrayWithObject:[NSExpression expressionForKeyPath:@"ddname"]]]; NSPredicate *pred = [NSPredicate predicateWithFormat:@"ddtype == 'Home'"]; NSExpressionDescription *ed = [[NSExpressionDescription alloc] init]; [ed setName:@"countDDEvents"]; [ed setExpression:ex]; [ed

Elasticsearch count terms ignoring spaces

∥☆過路亽.° 提交于 2019-12-03 03:14:41
Using ES 1.2.1 My aggregation { "size": 0, "aggs": { "cities": { "terms": { "field": "city","size": 300000 } } } } The issue is that some city names have spaces in them and aggregate separately. For instance Los Angeles { "key": "Los", "doc_count": 2230 }, { "key": "Angeles", "doc_count": 2230 }, I assume it has to do with the analyzer? Which one would I use to not split on spaces? For fields that you want to perform aggregations on I would recommend either the keyword analyzer or do not analyze the field at all. From the keyword analyzer documentation: An analyzer of type keyword that

C++ : Association, Aggregation and Composition

微笑、不失礼 提交于 2019-12-03 02:01:59
问题 I'm beginning to study OOAD and I'm having difficulty finding a C++ code example that'd illustrate how Association , Aggregation and Composition are implemented programmatically. (There are several posts everywhere but they relate to C# or java). I did find an example or two, but they all conflict with my instructor's instructions and I'm confused. My understanding is that in: Association: Foo has a pointer to Bar object as a data member Aggregation: Foo has a pointer to Bar object and data

association, aggregation and composition

爱⌒轻易说出口 提交于 2019-12-03 00:39:48
I'm dealing with this problem. I'm creating math problems, each one has response. For example. If my question is about the "result of 5x + 15 = 2?" , I'll be waiting just one answer (as integer). If my question is about says "give me the area and permiter of this shape" , I'll be waiting two answers (as doubles). In another one, I'll be waiting as response a string And anothers, I can have several answers or responses with various datatypes. My big question is. How would be the relation between the classes question and response. Also I was dealing if this should be an association, aggregation

Pandas: Average value for the past n days

て烟熏妆下的殇ゞ 提交于 2019-12-02 22:20:14
I have a Pandas data frame like this: test = pd.DataFrame({ 'Date' : ['2016-04-01','2016-04-01','2016-04-02', '2016-04-02','2016-04-03','2016-04-04', '2016-04-05','2016-04-06','2016-04-06'], 'User' : ['Mike','John','Mike','John','Mike','Mike', 'Mike','Mike','John'], 'Value' : [1,2,1,3,4.5,1,2,3,6] }) As you can see below, the data set does not have observations for every day necessarily: Date User Value 0 2016-04-01 Mike 1.0 1 2016-04-01 John 2.0 2 2016-04-02 Mike 1.0 3 2016-04-02 John 3.0 4 2016-04-03 Mike 4.5 5 2016-04-04 Mike 1.0 6 2016-04-05 Mike 2.0 7 2016-04-06 Mike 3.0 8 2016-04-06 John

Application log aggregation, management and notifications [closed]

浪尽此生 提交于 2019-12-02 18:30:44
I'm wondering what everyone is using for logging, log management and log aggregation on their systems. I am working in a company which uses .NET for all it's applications and all systems are Windows based. Currently each application looks after its own logging and notifications of failures (e.g. if app A fails it will send out its own 'call for help' to an admin). While this current practice works its a bit hacky and hard to manage. I've been trying to find some options for making this work better and I've come up with the following: log4net & Chainsaw (ah, if it works). Logging via log4net or

Aggregating key value pair in python

独自空忆成欢 提交于 2019-12-02 17:01:11
问题 I have a question related to python code. I need to aggregate if the key = kv1, how can I do that? input='num=123-456-7890&kv=1&kv2=12&kv3=0' result={} for pair in input.split('&'): (key,value) = pair.split('=') if key in 'kv1': print value result[key] += int(value) print result['kv1'] Thanks a lot!! 回答1: I'm assuming you meant key == 'kv1' and also the kv within input was meant to be kv1 and that result is an empty dict that doesn't need result[key] += int(value) just result[key] = int(value