# Data visualization with elasticsearch aggregations and d3 explaining

**URL:** <https://discuss.elastic.co/t/data-visualization-with-elasticsearch-aggregations-and-d3-explaining/21077>\
**Category:** Elasticsearch\
**Created:** [December 4, 2014, 7:00am UTC](https://discuss.elastic.co/t/data-visualization-with-elasticsearch-aggregations-and-d3-explaining/21077 "2014-12-04T07:00:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apert](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/apert/32/779_2.png) [@apert](https://discuss.elastic.co/u/apert)\
**Post date:** [December 4, 2014, 7:00am UTC](https://discuss.elastic.co/t/data-visualization-with-elasticsearch-aggregations-and-d3-explaining/21077/1 "2014-12-04T07:00:56Z")

</div>

Hi guys, i want to build graph using d3 and query from elassticsearch, but  
anyone here tell me what exactly mean by this code ?

client.search({  
index: 'nfl',  
size: 5,  
body: {  
// Begin query.  
query: {  
// Boolean query for matching and excluding items.  
bool: {  
must: {  
match: {  
"description": "TOUCHDOWN"  
// "season": "2012"  
}  
},  
must\_not: { match: { "qtr": 5 }}  
}  
},  
// Aggregate on the results  
aggs: {  
touchdowns: {  
terms: {  
field: "qtr",  
order: { "\_term" : "asc" }  
}  
}  
}  
// End query.  
}

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ed73a370-8623-4373-bfd6-16222b3b51c1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ed73a370-8623-4373-bfd6-16222b3b51c1%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![kazoompa\_3](https://avatars.discourse-cdn.com/v4/letter/k/958977/32.png) [@kazoompa\_3](https://discuss.elastic.co/u/kazoompa_3)\
**Post date:** [December 4, 2014, 1:27pm UTC](https://discuss.elastic.co/t/data-visualization-with-elasticsearch-aggregations-and-d3-explaining/21077/2 "2014-12-04T13:27:31Z")

</div>

You really need to go over the query documentation first, there are plenty  
of good examples and tutorials that will guide you and help you understand  
your snippet.

I gather you understand the query part, the aggregation part (there are  
lots of docs) shows the frequency (count) of touchdowns on field "qtr".

You really need to dive into the docs 🙂

On Thursday, December 4, 2014 2:00:56 AM UTC-5, Mohd Syafiq wrote:

> Hi guys, i want to build graph using d3 and query from elassticsearch, but  
> anyone here tell me what exactly mean by this code ?
> 
> client.search({  
> index: 'nfl',  
> size: 5,  
> body: {  
> // Begin query.  
> query: {  
> // Boolean query for matching and excluding items.  
> bool: {  
> must: {  
> match: {  
> "description": "TOUCHDOWN"  
> // "season": "2012"  
> }  
> },  
> must\_not: { match: { "qtr": 5 }}  
> }  
> },  
> // Aggregate on the results  
> aggs: {  
> touchdowns: {  
> terms: {  
> field: "qtr",  
> order: { "\_term" : "asc" }  
> }  
> }  
> }  
> // End query.  
> }

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/230e182a-529e-4343-8cb6-3eb7a39f2fa7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/230e182a-529e-4343-8cb6-3eb7a39f2fa7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:45am UTC](https://discuss.elastic.co/t/data-visualization-with-elasticsearch-aggregations-and-d3-explaining/21077/3 "2017-07-06T00:45:57Z")

</div>


