Facet: histogram with nested term count possible?

Hi,
I have an index of timestamped docs in elasticsearch, and I need to
generate a list of top 10 term counts, for each day. Since I am lazy, I am
trying to do this in elasticsearch as opposed to rolling up my sleeves and
coding it myself. Following the faceting search visualization tutorial,
I've got a nice date_histogram, and from the earlier example, term counts
are easy to do. Is this any way to nest a terms facet inside a
date_histogram facet, in such a way that the terms will be only given for a
given date?

If there is no way to do this, and I'm going to code it by hand anyways,
are there benefits/is it possible for me to write an elasticsearch plugin
to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest
(they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Not yet but with the facet refactoring, it will be possible in a next version.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 févr. 2013 à 20:23, Paul Sanwald paul@redowlanalytics.com a écrit :

Hi,
I have an index of timestamped docs in elasticsearch, and I need to generate a list of top 10 term counts, for each day. Since I am lazy, I am trying to do this in elasticsearch as opposed to rolling up my sleeves and coding it myself. Following the faceting search visualization tutorial, I've got a nice date_histogram, and from the earlier example, term counts are easy to do. Is this any way to nest a terms facet inside a date_histogram facet, in such a way that the terms will be only given for a given date?

If there is no way to do this, and I'm going to code it by hand anyways, are there benefits/is it possible for me to write an elasticsearch plugin to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest (they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Great news! What's the ETA of the next version release? Is there anything I
can do to help?

--paul

On Thursday, February 28, 2013 2:41:41 PM UTC-5, David Pilato wrote:

Not yet but with the facet refactoring, it will be possible in a next
version.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 févr. 2013 à 20:23, Paul Sanwald <pa...@redowlanalytics.com<javascript:>>
a écrit :

Hi,
I have an index of timestamped docs in elasticsearch, and I need to
generate a list of top 10 term counts, for each day. Since I am lazy, I am
trying to do this in elasticsearch as opposed to rolling up my sleeves and
coding it myself. Following the faceting search visualization tutorial,
I've got a nice date_histogram, and from the earlier example, term counts
are easy to do. Is this any way to nest a terms facet inside a
date_histogram facet, in such a way that the terms will be only given for a
given date?

If there is no way to do this, and I'm going to code it by hand anyways,
are there benefits/is it possible for me to write an elasticsearch plugin
to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest
(they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Considering the beta for 0.90 just come out, it might be a while before the
next release.

http://elasticsearch-users.115913.n3.nabble.com/Facets-Refactor-td4030599.html

On Thu, Feb 28, 2013 at 12:07 PM, Paul Sanwald paul@redowlanalytics.comwrote:

Great news! What's the ETA of the next version release? Is there anything
I can do to help?

--paul

On Thursday, February 28, 2013 2:41:41 PM UTC-5, David Pilato wrote:

Not yet but with the facet refactoring, it will be possible in a next
version.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 28 févr. 2013 à 20:23, Paul Sanwald pa...@redowlanalytics.com a
écrit :

Hi,
I have an index of timestamped docs in elasticsearch, and I need to
generate a list of top 10 term counts, for each day. Since I am lazy, I am
trying to do this in elasticsearch as opposed to rolling up my sleeves and
coding it myself. Following the faceting search visualization tutorial,
I've got a nice date_histogram, and from the earlier example, term counts
are easy to do. Is this any way to nest a terms facet inside a
date_histogram facet, in such a way that the terms will be only given for a
given date?

If there is no way to do this, and I'm going to code it by hand anyways,
are there benefits/is it possible for me to write an elasticsearch plugin
to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest
(they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@**googlegroups.com.

For more options, visit https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
.

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Paul,

We ran into a similar issue and I created plugin that can do it. Check out
FacetedDateHistogram: GitHub - bleskes/elasticfacets: A set of facets and related tools for ElasticSearch

Hope it helps,
Boaz

On Thursday, February 28, 2013 8:23:07 PM UTC+1, Paul Sanwald wrote:

Hi,
I have an index of timestamped docs in elasticsearch, and I need to
generate a list of top 10 term counts, for each day. Since I am lazy, I am
trying to do this in elasticsearch as opposed to rolling up my sleeves and
coding it myself. Following the faceting search visualization tutorial,
I've got a nice date_histogram, and from the earlier example, term counts
are easy to do. Is this any way to nest a terms facet inside a
date_histogram facet, in such a way that the terms will be only given for a
given date?

If there is no way to do this, and I'm going to code it by hand anyways,
are there benefits/is it possible for me to write an elasticsearch plugin
to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest
(they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Boaz,
I am using your plugin and it helps immensely. many thanks!

On Friday, March 1, 2013 3:16:55 AM UTC-5, Boaz Leskes wrote:

Hi Paul,

We ran into a similar issue and I created plugin that can do it. Check out
FacetedDateHistogram:
GitHub - bleskes/elasticfacets: A set of facets and related tools for ElasticSearch

Hope it helps,
Boaz

On Thursday, February 28, 2013 8:23:07 PM UTC+1, Paul Sanwald wrote:

Hi,
I have an index of timestamped docs in elasticsearch, and I need to
generate a list of top 10 term counts, for each day. Since I am lazy, I am
trying to do this in elasticsearch as opposed to rolling up my sleeves and
coding it myself. Following the faceting search visualization tutorial,
I've got a nice date_histogram, and from the earlier example, term counts
are easy to do. Is this any way to nest a terms facet inside a
date_histogram facet, in such a way that the terms will be only given for a
given date?

If there is no way to do this, and I'm going to code it by hand anyways,
are there benefits/is it possible for me to write an elasticsearch plugin
to do this kind of thing?

If it makes my question clearer, here's the two facets I'd like to nest
(they are in parallel below, but I ultimately want to nest them):

{
"query": {
"query_string": {
"query": "T*"
}
},
"facets": {
"published_on": {
"date_histogram": {
"field": "timestamp",
"interval": "day"
}
},
"term_count": {
"terms": {
"field": "subject"
}
}
}
}

Ideally I would like something like

{
"time": "1006300800000",
"count": 130,
"terms": [
{
"term": "re",
"count": 1302
},
{
"term": "fw",
"count": 389
}
]
}

Thanks for your help!

--paul

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

HI David,

from java, i want fetch data..

Settings settings = ImmutableSettings.settingsBuilder()
.put("http.enabled", "false")
.put("transport.tcp.port", "9300-9400")
.put("discovery.zen.ping.multicast.enabled", "false")
.put("discovery.zen.ping.unicast.hosts", "localhost").build();

      Node node = NodeBuilder.nodeBuilder().client(true).settings(settings).clusterName("elasticsearch").node();
      client = node.client();

SearchResponse response = client.prepareSearch().execute().actionGet();

SearchHit[] results = response.getHits().getHits();
System.out.println(results);
for (SearchHit hit : results) {
System.out.println(hit.getId()); //prints out the id of the document
result = hit.getSource(); //the retrieved document
System.out.println(result.keySet());
}

its working fine.. fetch data all types..

but i am not able to search specific text..

i did like this..

SearchResponse response = client.prepareSearch("_river")//"dc_demo_group_idx","dc_demo_idx","dc_demo_user_idx","dc_rule_metadata_idx","dc_lookup_data_idx","dc_demo_user_idx","dc_provider_idx","dc_topic_idx"
.setTypes("dc_user_river")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.termQuery("firstName", "a"))
.setFrom(0).setSize(60).setExplain(false)
.execute()
.actionGet();

respose is :

true{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
[Lorg.elasticsearch.search.internal.InternalSearchHit;@1b84276

how to get the actual content

can you please help me.