Can I find a list of indices containing documents which contain a specified term?

I'm building a simple app which presents the user with two drop-downs to
easily filter data: one for day (mapping to my daily indices), and one for
client (a term within documents).

I'm currently finding indices using curl -XGET localhost:9200/_aliases, and
a simple aggregation query to get a list of known clients over all indices.
It works, but since not every client is present on every date it feels
clunky when the client is known but the list of dates still contains all
indices, many of which are irrelevant for the selected client.

Can anyone recommend a good way of finding a list of indices in which there
is at least one document containing a specified term please? Thank you very
much.

--
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/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees chris@fixspec.com wrote:

I'm building a simple app which presents the user with two drop-downs to
easily filter data: one for day (mapping to my daily indices), and one for
client (a term within documents).

I'm currently finding indices using curl -XGET localhost:9200/_aliases,
and a simple aggregation query to get a list of known clients over all
indices. It works, but since not every client is present on every date it
feels clunky when the client is known but the list of dates still contains
all indices, many of which are irrelevant for the selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

--
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/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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/CAGdPd5kdfq2kuroxFVx2590k03SQf7T_H0PhrCGeA1_OoKMDxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Thanks Vineeth.

Unfortunately it doesn't return any results in the aggregations result.

Input query:
GET _search
{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Result JSON showing 26K hits (correct), but no index aggregations:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 57,
"successful": 57,
"failed": 0
},
"hits": {
"total": 26622,
"max_score": 1,
"hits": [...]
},
"aggregations": {
"aggs": {
"buckets": []
}
}
}

On Monday, September 1, 2014 1:40:00 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees <ch...@fixspec.com
<javascript:>> wrote:

I'm building a simple app which presents the user with two drop-downs to
easily filter data: one for day (mapping to my daily indices), and one for
client (a term within documents).

I'm currently finding indices using curl -XGET localhost:9200/_aliases,
and a simple aggregation query to get a list of known clients over all
indices. It works, but since not every client is present on every date it
feels clunky when the client is known but the list of dates still contains
all indices, many of which are irrelevant for the selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

--
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:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Chris ,

That is strange , its working fine on my side.

Can you run the below and paste the result -

curl -XPOST 'http://localhost:9200/_search' -d '{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}'
Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:17 PM, Chris Lees chris@fixspec.com wrote:

Thanks Vineeth.

Unfortunately it doesn't return any results in the aggregations result.

Input query:
GET _search

{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Result JSON showing 26K hits (correct), but no index aggregations:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 57,
"successful": 57,
"failed": 0
},
"hits": {
"total": 26622,
"max_score": 1,
"hits": [...]
},
"aggregations": {
"aggs": {
"buckets": []

  }

}
}

On Monday, September 1, 2014 1:40:00 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees ch...@fixspec.com wrote:

I'm building a simple app which presents the user with two drop-downs to
easily filter data: one for day (mapping to my daily indices), and one for
client (a term within documents).

I'm currently finding indices using curl -XGET localhost:9200/_aliases,
and a simple aggregation query to get a list of known clients over all
indices. It works, but since not every client is present on every date it
feels clunky when the client is known but the list of dates still contains
all indices, many of which are irrelevant for the selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%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/CAGdPd5%3DNtGZhQRDkX90p39KxpRNeekbWSq5gasyaVK%3DevUHe_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Same result I'm afraid...

{
"took": 62,
"timed_out": false,
"_shards": {
"total": 147,
"successful": 144,
"failed": 0
},
"hits": {
"total": 9975671,
"max_score": 1.0,
"hits": [
... results removed as data is sensitive, but I see correct
documents returned in here ...
]
},
"aggregations": {
"aggs": {
"buckets": []
}
}
}

I'm still running Elasticsearch 1.1.1 -- is this something that changed
after that perhaps?

Thanks for your help.

On Monday, September 1, 2014 2:23:17 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

That is strange , its working fine on my side.

Can you run the below and paste the result -

curl -XPOST 'http://localhost:9200/_search' -d '{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}'
Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:17 PM, Chris Lees <ch...@fixspec.com
<javascript:>> wrote:

Thanks Vineeth.

Unfortunately it doesn't return any results in the aggregations result.

Input query:
GET _search

{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Result JSON showing 26K hits (correct), but no index aggregations:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 57,
"successful": 57,
"failed": 0
},
"hits": {
"total": 26622,
"max_score": 1,
"hits": [...]
},
"aggregations": {
"aggs": {
"buckets": []

  }

}
}

On Monday, September 1, 2014 1:40:00 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees ch...@fixspec.com wrote:

I'm building a simple app which presents the user with two drop-downs
to easily filter data: one for day (mapping to my daily indices), and one
for client (a term within documents).

I'm currently finding indices using curl -XGET localhost:9200/_aliases,
and a simple aggregation query to get a list of known clients over all
indices. It works, but since not every client is present on every date it
feels clunky when the client is known but the list of dates still contains
all indices, many of which are irrelevant for the selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%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/e7c82301-e7b7-4ea9-91e9-cbea714f1712%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Chris ,

I am using ES 1.3.1
Can you give it a try on that version.

Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:59 PM, Chris Lees chris@fixspec.com wrote:

Same result I'm afraid...

{
"took": 62,
"timed_out": false,
"_shards": {
"total": 147,
"successful": 144,
"failed": 0
},
"hits": {
"total": 9975671,
"max_score": 1.0,
"hits": [
... results removed as data is sensitive, but I see correct
documents returned in here ...
]
},
"aggregations": {
"aggs": {
"buckets": []
}
}
}

I'm still running Elasticsearch 1.1.1 -- is this something that changed
after that perhaps?

Thanks for your help.

On Monday, September 1, 2014 2:23:17 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

That is strange , its working fine on my side.

Can you run the below and paste the result -

curl -XPOST 'http://localhost:9200/_search' -d '{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}'
Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:17 PM, Chris Lees ch...@fixspec.com wrote:

Thanks Vineeth.

Unfortunately it doesn't return any results in the aggregations result.

Input query:
GET _search

{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Result JSON showing 26K hits (correct), but no index aggregations:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 57,
"successful": 57,
"failed": 0
},
"hits": {
"total": 26622,
"max_score": 1,
"hits": [...]
},
"aggregations": {
"aggs": {
"buckets": []

  }

}
}

On Monday, September 1, 2014 1:40:00 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees ch...@fixspec.com wrote:

I'm building a simple app which presents the user with two drop-downs
to easily filter data: one for day (mapping to my daily indices), and one
for client (a term within documents).

I'm currently finding indices using curl -XGET
localhost:9200/_aliases, and a simple aggregation query to get a list of
known clients over all indices. It works, but since not every client is
present on every date it feels clunky when the client is known but the list
of dates still contains all indices, many of which are irrelevant for the
selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%40goo
glegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%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/e7c82301-e7b7-4ea9-91e9-cbea714f1712%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/e7c82301-e7b7-4ea9-91e9-cbea714f1712%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/CAGdPd5kjcXygmKA77tuheiWJvWpGVvDTJ18a9_42QVY7Eff41w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Apologies for delay -- upgrading took a while to get through./

You are right -- 1.3.2 resolved this issue and I'm now able to run
aggregations on _index.

Thanks for your help.

On Monday, September 1, 2014 4:13:31 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

I am using ES 1.3.1
Can you give it a try on that version.

Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:59 PM, Chris Lees <ch...@fixspec.com
<javascript:>> wrote:

Same result I'm afraid...

{
"took": 62,
"timed_out": false,
"_shards": {
"total": 147,
"successful": 144,
"failed": 0
},
"hits": {
"total": 9975671,
"max_score": 1.0,
"hits": [
... results removed as data is sensitive, but I see correct
documents returned in here ...
]
},
"aggregations": {
"aggs": {
"buckets": []
}
}
}

I'm still running Elasticsearch 1.1.1 -- is this something that changed
after that perhaps?

Thanks for your help.

On Monday, September 1, 2014 2:23:17 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

That is strange , its working fine on my side.

Can you run the below and paste the result -

curl -XPOST 'http://localhost:9200/_search' -d '{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}'
Thanks
Vineeth

On Mon, Sep 1, 2014 at 6:17 PM, Chris Lees ch...@fixspec.com wrote:

Thanks Vineeth.

Unfortunately it doesn't return any results in the aggregations result.

Input query:
GET _search

{
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Result JSON showing 26K hits (correct), but no index aggregations:
{
"took": 4,
"timed_out": false,
"_shards": {
"total": 57,
"successful": 57,
"failed": 0
},
"hits": {
"total": 26622,
"max_score": 1,
"hits": [...]
},
"aggregations": {
"aggs": {
"buckets": []

  }

}
}

On Monday, September 1, 2014 1:40:00 PM UTC+1, vineeth mohan wrote:

Hello Chris ,

This should work -

{
"query" : {
// GIVE QUERY HERE
},
"aggregations": {
"aggs": {
"terms": {
"field": "_index"
}
}
}
}

Thanks
Vineeth

On Mon, Sep 1, 2014 at 3:10 PM, Chris Lees ch...@fixspec.com wrote:

I'm building a simple app which presents the user with two drop-downs
to easily filter data: one for day (mapping to my daily indices), and one
for client (a term within documents).

I'm currently finding indices using curl -XGET
localhost:9200/_aliases, and a simple aggregation query to get a list of
known clients over all indices. It works, but since not every client is
present on every date it feels clunky when the client is known but the list
of dates still contains all indices, many of which are irrelevant for the
selected client.

Can anyone recommend a good way of finding a list of indices in which
there is at least one document containing a specified term please? Thank
you very much.

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

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%40goo
glegroups.com
https://groups.google.com/d/msgid/elasticsearch/3dcf46da-3eeb-4503-a348-365e3f0fd7a0%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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/a485bf59-4ab6-43a3-b3df-172b8d09e7ba%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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/e7c82301-e7b7-4ea9-91e9-cbea714f1712%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/e7c82301-e7b7-4ea9-91e9-cbea714f1712%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/25a714bc-6d73-480b-861c-f59c7ae7879b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.