Returning only unique results

Is there someway in elasticsearch to adapt the following query so that it
only produces unique results. For example I have the following data:

Name | Age | Height

John | 10 | 4'6
John | 11 | 4'8
John | 12 | 4'10
John | 12 | 4'11
Adam | 12 | 4'12

I want to adjust the following query:

{
"query": {
"match_all": {}
},
"terms": {
"field": "name"
}
}

So that it returns the following:

Name | Age | Height

John | 12 | 4'11
Adam | 12 | 4'12

Also, how can I adjust it to group by two fields?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/571309b4-05df-4a08-b90e-6a9cb115021f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

This is similar to the question I asked last week.

https://groups.google.com/forum/#!topic/elasticsearch/w4C1m1u55FA

On Tuesday, May 27, 2014 12:39:22 AM UTC-4, John wrote:

Is there someway in elasticsearch to adapt the following query so that it
only produces unique results. For example I have the following data:

Name | Age | Height

John | 10 | 4'6
John | 11 | 4'8
John | 12 | 4'10
John | 12 | 4'11
Adam | 12 | 4'12

I want to adjust the following query:

{
"query": {
"match_all": {}
},
"terms": {
"field": "name"
}
}

So that it returns the following:

Name | Age | Height

John | 12 | 4'11
Adam | 12 | 4'12

Also, how can I adjust it to group by two fields?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b1ebc645-610f-4f66-a572-01e7e5cbb597%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Perhaps the top hits aggregation coming in 1.3 could help:

--
Ivan

On Tue, May 27, 2014 at 5:36 AM, ES USER es.user.2014@gmail.com wrote:

This is similar to the question I asked last week.

Redirecting to Google Groups

On Tuesday, May 27, 2014 12:39:22 AM UTC-4, John wrote:

Is there someway in elasticsearch to adapt the following query so that it
only produces unique results. For example I have the following data:

Name | Age | Height

John | 10 | 4'6
John | 11 | 4'8
John | 12 | 4'10
John | 12 | 4'11
Adam | 12 | 4'12

I want to adjust the following query:

{
"query": {
"match_all": {}
},
"terms": {
"field": "name"
}
}

So that it returns the following:

Name | Age | Height

John | 12 | 4'11
Adam | 12 | 4'12

Also, how can I adjust it to group by two fields?

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/b1ebc645-610f-4f66-a572-01e7e5cbb597%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/b1ebc645-610f-4f66-a572-01e7e5cbb597%40googlegroups.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCAQjz%2BccnKHfixSVTUwQGefTh0ZUmMo48JTq0C%3DNP%3D9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.