Heya,

Just pushed the (long requested) terms stats facet: https://github.com/elasticsearch/elasticsearch/issues/705.

-shay.banon

Heya,

Just pushed the (long requested) terms stats facet: https://github.com/elasticsearch/elasticsearch/issues/705.

-shay.banon

Excellent news. I have never officially requested it, but it is

feature that I have needed. I have been using term facet_filters with

the stats facet to achieve the same effect (thankfully the terms are a

small predetermined set). Will test it out soon.

Thanks!

Ivan

On Feb 19, 4:38 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Heya,

Just pushed the (long requested) terms stats facet:https://github.com/elasticsearch/elasticsearch/issues/705.

-shay.banon

I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_thread/thread/6e524daeb77d7060/d518c70310eb0405

will be easily resolved with min values in terms stats facets.

Regards

Wojciech Durczyński

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech DurczyÅski wrote:

I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_thread/thread/6e524daeb77d7060/d518c70310eb0405

will be easily resolved with min values in terms stats facets.Regards

Wojciech DurczyÅski

ok, pushed support for it. Min and max are in. if sum of squares is also required, it can be added as well (though every addition does come at a cost).

On Wednesday, February 23, 2011 at 7:29 PM, Shay Banon wrote:

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech DurczyÅski wrote:I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_thread/thread/6e524daeb77d7060/d518c70310eb0405

will be easily resolved with min values in terms stats facets.Regards

Wojciech DurczyÅski

Could you please post an example how to query min/max value of a

particular field? I was not able to find it in the current

documentation. How do I use Java to do this task?

Thanks,

Eugene.

On Feb 23, 10:37 am, Shay Banon shay.ba...@elasticsearch.com wrote:

ok, pushed support for it. Min and max are in. if sum of squares is also required, it can be added as well (though every addition does come at a cost).

On Wednesday, February 23, 2011 at 7:29 PM, Shay Banon wrote:

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech Durczyński wrote:I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_threa...

will be easily resolved with min values in terms stats facets.Regards

Wojciech Durczyński- Hide quoted text -

- Show quoted text -

For min max of a field, use the statistical facet. In the Java API, call addFacet on the SearchRequestBuilder you get from prepareSearch, and add a FacetBuilders#statisticalFacet.

On Tuesday, March 8, 2011 at 8:43 PM, eugene wrote:

Could you please post an example how to query min/max value of a

particular field? I was not able to find it in the current

documentation. How do I use Java to do this task?Thanks,

Eugene.On Feb 23, 10:37 am, Shay Banon shay.ba...@elasticsearch.com wrote:

ok, pushed support for it. Min and max are in. if sum of squares is also required, it can be added as well (though every addition does come at a cost).

On Wednesday, February 23, 2011 at 7:29 PM, Shay Banon wrote:

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech DurczyÅski wrote:I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_threa...

will be easily resolved with min values in terms stats facets.Regards

Wojciech DurczyÅski- Hide quoted text -

- Show quoted text -

Thank you, Shay. Your suggestion was very helpful. Let me describe

the entire problem. I am trying to pull document under some index with

largest '_id' value. I can set facet on any field, but it didn't work

on _id. Do you know if there is a way to retrieve doc with maximum

_id?

On Mar 8, 11:08 am, Shay Banon shay.ba...@elasticsearch.com wrote:

For min max of a field, use the statistical facet. In the Java API, call addFacet on the SearchRequestBuilder you get from prepareSearch, and add a FacetBuilders#statisticalFacet.

On Tuesday, March 8, 2011 at 8:43 PM, eugene wrote:

Could you please post an example how to query min/max value of a

particular field? I was not able to find it in the current

documentation. How do I use Java to do this task?Thanks,

Eugene.On Feb 23, 10:37 am, Shay Banon shay.ba...@elasticsearch.com wrote:

ok, pushed support for it. Min and max are in. if sum of squares is also required, it can be added as well (though every addition does come at a cost).

On Wednesday, February 23, 2011 at 7:29 PM, Shay Banon wrote:

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech Durczyński wrote:I'm very glad to see this functionality. Thank you very much for it.

As described in guide about statistical facet:

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_threa...

will be easily resolved with min values in terms stats facets.Regards

Wojciech Durczyński- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

Eugene, have you thought about just using the "_id" field as the field

you let your search query be sorted with? In case you take this as

primary sort option the one on the top is either the smallest or the

largest _id (Descending/ Ascending sort)

Best

On 9 Mrz., 09:22, eugene efur...@gmail.com wrote:

Thank you, Shay. Your suggestion was very helpful. Let me describe

the entire problem. I am trying to pull document under some index with

largest '_id' value. I can set facet on any field, but it didn't work

on _id. Do you know if there is a way to retrieve doc with maximum

_id?On Mar 8, 11:08 am, Shay Banon shay.ba...@elasticsearch.com wrote:

For min max of a field, use the statistical facet. In the Java API, call addFacet on the SearchRequestBuilder you get from prepareSearch, and add a FacetBuilders#statisticalFacet.

On Tuesday, March 8, 2011 at 8:43 PM, eugene wrote:

particular field? I was not able to find it in the current

documentation. How do I use Java to do this task?Thanks,

Eugene.On Feb 23, 10:37 am, Shay Banon shay.ba...@elasticsearch.com wrote:

On Wednesday, February 23, 2011 at 7:29 PM, Shay Banon wrote:

Right, it does not include the min/max, open an issue and I will add it

On Wednesday, February 23, 2011 at 4:51 PM, Wojciech Durczyński wrote:I'm very glad to see this functionality. Thank you very much for it.

The statistical data include count, total, sum of squares, mean

(average), minimum, maximum, variance, and standard deviation.

Will terms stats facet include them also? I see total and count only

now. And my usecase described here:

http://groups.google.com/a/elasticsearch.com/group/users/browse_threa...

will be easily resolved with min values in terms stats facets.Regards

Wojciech Durczyński- Hide quoted text -

- Show quoted text -- Hide quoted text -

- Show quoted text -

On 9 March 2011 21:09, K.B. korbinian.bachl@googlemail.com wrote:

Eugene, have you thought about just using the "_id" field as the field

you let your search query be sorted with? In case you take this as

primary sort option the one on the top is either the smallest or the

largest _id (Descending/ Ascending sort)

just be awfully careful using sorting on such a unique field like _id. This

will scale badly in terms of memory because sorting costs in lucene is a

function of the # unique terms. This will work fine in a small sample set

but will be armageddon in a large production setup.

wouldn't recommend that.

Paul

Thanks Paul. I actually ended up not using auto-incremented _id and

checking the largest value of _id each time I index a new document, I

didn't specify it and the system now generates it automatically.

On Mar 9, 2:45 pm, Paul Smith tallpsm...@gmail.com wrote:

On 9 March 2011 21:09, K.B. korbinian.ba...@googlemail.com wrote:

Eugene, have you thought about just using the "_id" field as the field

you let your search query be sorted with? In case you take this as

primary sort option the one on the top is either the smallest or the

largest _id (Descending/ Ascending sort)just be awfully careful using sorting on such a unique field like _id. This

will scale badly in terms of memory because sorting costs in lucene is a

function of the # unique terms. This will work fine in a small sample set

but will be armageddon in a large production setup.wouldn't recommend that.

Paul

In page: http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet.html

"Note, the terms stats can work with multi valued key fields, or multi valued value fields, but not when both are multi valued (as ordering is not maintained)."

But how to build the query, I want to statistic of "hoursWorked" of a "Task log" have for {groupId and projectId}, please tell me!

I tried:

```
{
"query": {
"match_all": {
}
},
"facets": {
"hoursWorked_stats": {
"terms_stats": {
"key_field": ["groupId",
"projectId"],
"value_field": "hoursWorked",
"size": 1000
}
}
}
}
```

But it's not working!

Terms Stats facet can indeed work with multi valued key fields, which means

that it can work with documents that have more than one value in the the

key_field. It doesn't work with multiple key fields though. I would try

adding a special field groupIdProjectId that would contain

concatenated group ID and project ID in a single field and use this field

as key_field.

On Friday, November 2, 2012 4:56:27 AM UTC-4, Nguyen Van De wrote:

In page:

http://www.elasticsearch.org/guide/reference/api/search/facets/terms-stats-facet.html"Note, the terms stats can work with multi valued key fields, or multi

valued value fields, but not when both are multi valued (as ordering is not

maintained)."But how to build the query, I want to statistic of "hoursWorked" of a

"Task log" have for {groupId and projectId}, please tell me! I tried:{

"query": {

"match_all": {`}`

},

"facets": {

"hoursWorked_stats": {

"terms_stats": {

"key_field": ["groupId",

"projectId"],

"value_field": "hoursWorked",

"size": 1000

}

}

}

}## But it's not working!

View this message in context: Re: Just Pushed: Terms Stats Facetshttp://elasticsearch-users.115913.n3.nabble.com/Just-Pushed-Terms-Stats-Facets-tp2535898p4024723.html

Sent from the ElasticSearch Users mailing list archivehttp://elasticsearch-users.115913.n3.nabble.com/at Nabble.com.

--