Return unique records for a certain field

I have the following problem, I have a document say

foo {
bar:1
--other fields--
}

I want to call a query that will return results based on other fields but
with bar been unique at the result set, meaning if there are more then 1
document matching the query that has bar == 1 I want to return only 1
results, say the first result.

This is like doing a group by and only taking the first record at the each
group

How can I do this in Elastic?

--
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.

From what I can understand, you are probably looking for something like
field collapsing, which is not (yet?) implemented in elasticsearch.

Can you provide an pseudo-example with a sample document and query?

--
Ivan

On Sat, Jun 1, 2013 at 12:48 AM, David MZ david.mazvovsky@gmail.com wrote:

I have the following problem, I have a document say

foo {
bar:1
--other fields--
}

I want to call a query that will return results based on other fields but
with bar been unique at the result set, meaning if there are more then 1
document matching the query that has bar == 1 I want to return only 1
results, say the first result.

This is like doing a group by and only taking the first record at the each
group

How can I do this in Elastic?

--
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.