aggregation

Elastic Search. _Score is null in aggregations. Why?

老子叫甜甜 提交于 2019-12-24 00:53:06
问题 I use ES v 1.7. ES returns _score just only in "hits" section, but i'm not interested in "hits", I need data from "aggregations" section of responce with _score . Why ES do like that and How to fix it? Requset: { "size": 1, "query": { "bool": { "must": [ { "match": {"_all": {"query": "test","operator": "and","fuzziness": "2"}}} ], "should": [ { "multi_match" : { "query": "test" ,"type": "best_fields" ,"fields": ["ObjectData.PRTNAME","ObjectData.EXTERNALID","ObjectData.contactList.VALUE","

Aggregation on time range

大城市里の小女人 提交于 2019-12-23 17:02:52
问题 I have a data-set that contains date {yyyy/mm/dd} and time {h,m,s} and temperature {float} as an individual columns. I want to aggregate temperature values for each day by average function. The problem is that, I don't know how I can query the time attribute to say for example aggregate {h,m, (0-5)s} and {h,m, (5-10)s} and {h,m, (10-15)s} and ..., automatically. 回答1: select day, to_char(date_trunc('minute', "time"), 'HH24:MI') as "minute", extract(second from "time")::integer / 5 as "range",

Summarizing two conditions on the same SQL table

﹥>﹥吖頭↗ 提交于 2019-12-23 12:50:05
问题 Given a SQL table Transactions ID INT COMPANY_ID INT STATUS INT where STATUS IN (0,1) indicates a free transaction and STATUS IN (2,3) indicates a billable transaction, what simple (I hope) ANSI SQL statement will show me, per COMPANY_ID , the number of billable transactions, non-billable transactions, and their ratio? A conceptual prod in the right direction is fine if not a specific statement. My first attempts are to self-join on the table with WHERE clauses for the two status groups, but

Conditional count and group by in R

天大地大妈咪最大 提交于 2019-12-22 18:09:05
问题 I would like to count how many rows there are per type if they meet the condition x == 0 . Sort of like a group by in SQL Here is an example of the data type x search 0 NULL 0 public 0 search 1 home 0 home 1 search 0 回答1: I am assuming that you want to find the number of rows when a particular condition (when a variable is having some value) is met. If this is the case, then I suppose you have "x" as a variable represented in a column. "x" can take multiple values. Suppose you want to find

MongoDB C# Aggregation with LINQ

若如初见. 提交于 2019-12-22 08:11:40
问题 I have a mongo object with these fields: DateTime TimeStamp; float Value; How can I get the aggregation pipeline, in C#, with LINQ, to get the minimum, maximum and average of Value over a specific timestamp range? I have seen a few aggregation examples, but I don't quite get it. Having an example on a simple case like this would certainly (hopefully) make me understand it. 回答1: You can use LINQ syntax which gets translated into Aggregation Framework's syntax. Assuming you have following Model

Timeline Action Layout - No Attachment displayed

为君一笑 提交于 2019-12-22 04:46:06
问题 I am trying to post a Action to the Facebook Timeline using the JS API FB.api('/me/application:action_type' + '?opject_type='+document.location.href,'post', function(response) { if (!response || response.error) { alert("error"); } else { alert("success"); } }); Posting works quite well and the API returns no error. A new activity appears at the Timeline but only as a small text within the "recent activities" box which looks like this: What could be the problem if the action is not displayed

How to maven build child projects?

删除回忆录丶 提交于 2019-12-22 04:42:22
问题 I have aggregation where I link a parent Pom using the <modules> element, and then I have the <parent> specified in each child pom. Is there a way I can build only a subset of the child modules from the parent pom... i.e. cd parent-dir mvn install subproj1 subproj2 回答1: You can run Maven like this: mvn install -pl subproj1,subproj2 PS: another good Maven command to try: mvn -? 来源: https://stackoverflow.com/questions/13567960/how-to-maven-build-child-projects

Does storing aggregated data go against database normalization?

我是研究僧i 提交于 2019-12-21 20:28:13
问题 On sites like SO, I'm sure it's absolutely necessary to store as much aggregated data as possible to avoid performing all those complex queries/calculations on every page load. For instance, storing a running tally of the vote count for each question/answer, or storing the number of answers for each question, or the number of times a question has been viewed so that these queries don't need to be performed as often. But does doing this go against db normalization, or any other standards/best

Selecting positive aggregate value and ignoring negative in Postgres SQL

大城市里の小女人 提交于 2019-12-21 16:59:38
问题 I must apply a certain transformation fn(argument) . Here argument is equal to value , but not when it is negative. When you get a first negative value , then you "wait" until it sums up with consecutive values and this sum becomes positive. Then you do fn(argument) . See the table I want to get: value argument --------------------- 2 2 3 3 -10 0 4 0 3 0 10 7 1 1 I could have summed all values and apply fn to the sum, but fn can be different for different rows and it is essential to know the

Group by column “grp” and compress DataFrame - (take last not null value for each column ordering by column “ord”)

二次信任 提交于 2019-12-21 15:27:47
问题 Assuming I have the following DataFrame: +---+--------+---+----+----+ |grp|null_col|ord|col1|col2| +---+--------+---+----+----+ | 1| null| 3|null| 11| | 2| null| 2| xxx| 22| | 1| null| 1| yyy|null| | 2| null| 7|null| 33| | 1| null| 12|null|null| | 2| null| 19|null| 77| | 1| null| 10| s13|null| | 2| null| 11| a23|null| +---+--------+---+----+----+ here is the same sample DF with comments, sorted by grp and ord : scala> df.orderBy("grp", "ord").show +---+--------+---+----+----+ |grp|null_col