Aggregations across multiple indices

Hello Everyone,
I am attempting to use aggregations to count the number of documents
matching a given query across multiple indices. What I would like to do, is
make those counts on distinct keys. Say I had following document in 2
different indices, aliased together.

{
    _index: myindex
    _type: mytype
    _id: 1
    _version: 1
    _score: 1
    _source: {
        country: MEXICO
    }
}```

When I make an aggs term query on the field "country" I would like it to
only return a single count for the document with id=1(which exists in both
indices). The actual use case is a bit more complicated than what's
described above, this is just an example of the functionality that I am
looking for. I cannot find any info in the docs, and have asked in the IRC
channel to no avail.

-Christian Rohling

-- 
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/CALsYvrzV-PyUNUHcUHWNCDBQKz5jV9%3DTPoQ2hW1me8q%2BhBgKDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

you might look at

--K

Karl Putland
Senior Engineer
SimpleSignal
Anywhere: 303-242-8608
http://www.simplesignal.com/explainer_video.php

On Thu, Mar 12, 2015 at 10:04 AM, Christian Rohling crohling88@gmail.com
wrote:

Hello Everyone,
I am attempting to use aggregations to count the number of documents
matching a given query across multiple indices. What I would like to do, is
make those counts on distinct keys. Say I had following document in 2
different indices, aliased together.

{
    _index: myindex
    _type: mytype
    _id: 1
    _version: 1
    _score: 1
    _source: {
        country: MEXICO
    }
}```

When I make an aggs term query on the field "country" I would like it to
only return a single count for the document with id=1(which exists in both
indices). The actual use case is a bit more complicated than what's
described above, this is just an example of the functionality that I am
looking for. I cannot find any info in the docs, and have asked in the IRC
channel to no avail.

-Christian Rohling

--
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/CALsYvrzV-PyUNUHcUHWNCDBQKz5jV9%3DTPoQ2hW1me8q%2BhBgKDg%40mail.gmail.com
<https://groups.google.com/d/msgid/elasticsearch/CALsYvrzV-PyUNUHcUHWNCDBQKz5jV9%3DTPoQ2hW1me8q%2BhBgKDg%40mail.gmail.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/CA%2BEXWszW-B43Mc%2B6LZMxA5x2Hym5EPgNFQ%3DZ0a1da7s2yjEAyw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

1 Like

Karl, thank you. That does solve the problem.

-Christian
On Mar 12, 2015 5:35 PM, "Karl Putland" karl@simplesignal.com wrote:

you might look at
Cardinality aggregation | Elasticsearch Guide [8.11] | Elastic

--K

Karl Putland
Senior Engineer
SimpleSignal
Anywhere: 303-242-8608
http://www.simplesignal.com/explainer_video.php

On Thu, Mar 12, 2015 at 10:04 AM, Christian Rohling crohling88@gmail.com
wrote:

Hello Everyone,
I am attempting to use aggregations to count the number of documents
matching a given query across multiple indices. What I would like to do, is
make those counts on distinct keys. Say I had following document in 2
different indices, aliased together.

{
    _index: myindex
    _type: mytype
    _id: 1
    _version: 1
    _score: 1
    _source: {
        country: MEXICO
    }
}```

When I make an aggs term query on the field "country" I would like it to
only return a single count for the document with id=1(which exists in both
indices). The actual use case is a bit more complicated than what's
described above, this is just an example of the functionality that I am
looking for. I cannot find any info in the docs, and have asked in the IRC
channel to no avail.

-Christian Rohling

--
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/CALsYvrzV-PyUNUHcUHWNCDBQKz5jV9%3DTPoQ2hW1me8q%2BhBgKDg%40mail.gmail.com
<https://groups.google.com/d/msgid/elasticsearch/CALsYvrzV-PyUNUHcUHWNCDBQKz5jV9%3DTPoQ2hW1me8q%2BhBgKDg%40mail.gmail.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/CA%2BEXWszW-B43Mc%2B6LZMxA5x2Hym5EPgNFQ%3DZ0a1da7s2yjEAyw%40mail.gmail.com
https://groups.google.com/d/msgid/elasticsearch/CA%2BEXWszW-B43Mc%2B6LZMxA5x2Hym5EPgNFQ%3DZ0a1da7s2yjEAyw%40mail.gmail.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/CALsYvryw0a%2BdwqhZALgJRZAOPcyK%3DWTgvTErscZo0726oV4ybg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.