# Enabled "\_index" does not allow me to get facet values

**URL:** https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200
**Category:** Elasticsearch
**Created:** [August 9, 2010, 2:13pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200 "2010-08-09T14:13:57Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [August 9, 2010, 2:13pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/1 "2010-08-09T14:13:57Z")

</div>

I attached test case into the ticket:

> <https://github.com/elastic/elasticsearch/issues/292>

Regards,  
Lukas

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 9, 2010, 5:32pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/2 "2010-08-09T17:32:46Z")

</div>

just pushed a fix for this, can you test it?

On Mon, Aug 9, 2010 at 5:13 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> I attached test case into the ticket:  
> [Add the ability to store the index name in the doc · Issue #292 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/292)
> 
> Regards,  
> Lukas

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [August 9, 2010, 6:46pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/3 "2010-08-09T18:46:07Z")

</div>

So, I reindex my data and I can see with Luke that "\_index" field is in  
index now, cool. However, my query still returns empty terms : array for  
the "index" facet. What am I doing wrong? And am I using it correctly at  
all? Is "\_index" supposed to work the same way in facets as "\_type"?

Here is the query:

curl -XGET '[http://localhost:9200/foo/bar/\_search?pretty=1](http://localhost:9200/foo/bar/_search?pretty=1)' -d '  
{  
"size" : 1,  
"query" : { "match\_all":{}},  
"facets" : {  
"type" : {  
"terms" : { "field" : "\_type"}  
},  
"index" : {  
"terms" : { "field" : "\_index" }  
}  
}  
}'

Here is output:

{  
"\_shards" : {  
"total" : 1,  
"successful" : 1,  
"failed" : 0  
},  
"hits" : {  
"total" : 3,  
"max\_score" : 1.0,  
"hits" : [ {  
"\_index" : "foo",  
"\_type" : "bar",  
"\_id" : "1",  
"\_score" : 1.0, "\_source" : {"field1":"value1","field2":"1"}  
} ]  
},  
"facets" : {  
"type" : {  
"\_type" : "terms",  
"\_field" : "\_type",  
"terms" : [ {  
"term" : "bar",  
"count" : 3  
} ]  
},  
"index" : {  
"\_type" : "terms",  
"\_field" : "\_index",  
"terms" :   
}  
}  
}

On Mon, Aug 9, 2010 at 7:32 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> just pushed a fix for this, can you test it?
> 
> On Mon, Aug 9, 2010 at 5:13 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:
> 
> > I attached test case into the ticket:  
> > [Add the ability to store the index name in the doc · Issue #292 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/292)
> > 
> > Regards,  
> > Lukas

---

<div class="post-metadata">

### Author: ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)
#### Post date: [August 9, 2010, 6:49pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/4 "2010-08-09T18:49:40Z")

</div>

I've ran your script in the case and I do get back the terms for the index,  
here is what I get:

{"error":"[foo]  
missing"}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"1"}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"2"}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"3"}{"ok":true,"\_shards":{"total":1,"successful":1,"failed":0}}{  
"\_shards" : {  
"total" : 1,  
"successful" : 1,  
"failed" : 0  
},  
"hits" : {  
"total" : 3,  
"max\_score" : 1.0,  
"hits" :   
},  
"facets" : {  
"type" : {  
"\_type" : "terms",  
"\_field" : "\_type",  
"terms" : [ {  
"term" : "bar",  
"count" : 3  
} ]  
},  
"index" : {  
"\_type" : "terms",  
"\_field" : "\_index",  
"terms" : [ {  
"term" : "foo",  
"count" : 3  
} ]  
}  
}  
}

On Mon, Aug 9, 2010 at 9:46 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> So, I reindex my data and I can see with Luke that "\_index" field is in  
> index now, cool. However, my query still returns empty terms : array for  
> the "index" facet. What am I doing wrong? And am I using it correctly at  
> all? Is "\_index" supposed to work the same way in facets as "\_type"?
> 
> Here is the query:
> 
> curl -XGET '[http://localhost:9200/foo/bar/\_search?pretty=1](http://localhost:9200/foo/bar/_search?pretty=1)' -d '  
> {  
> "size" : 1,  
> "query" : { "match\_all":{}},  
> "facets" : {  
> "type" : {  
> "terms" : { "field" : "\_type"}  
> },  
> "index" : {  
> "terms" : { "field" : "\_index" }  
> }  
> }  
> }'
> 
> Here is output:
> 
> {  
> "\_shards" : {  
> "total" : 1,  
> "successful" : 1,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 3,  
> "max\_score" : 1.0,  
> "hits" : [ {  
> "\_index" : "foo",  
> "\_type" : "bar",  
> "\_id" : "1",  
> "\_score" : 1.0, "\_source" : {"field1":"value1","field2":"1"}  
> } ]  
> },  
> "facets" : {  
> "type" : {  
> "\_type" : "terms",  
> "\_field" : "\_type",  
> "terms" : [ {  
> "term" : "bar",  
> "count" : 3  
> } ]  
> },  
> "index" : {  
> "\_type" : "terms",  
> "\_field" : "\_index",  
> "terms" :   
> }  
> }  
> }
> 
> On Mon, Aug 9, 2010 at 7:32 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> 
> > just pushed a fix for this, can you test it?
> > 
> > On Mon, Aug 9, 2010 at 5:13 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> > 
> > > I attached test case into the ticket:  
> > > [Add the ability to store the index name in the doc · Issue #292 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/292)
> > > 
> > > Regards,  
> > > Lukas

---

<div class="post-metadata">

### Author: ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)
#### Post date: [August 9, 2010, 7:02pm UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/5 "2010-08-09T19:02:23Z")

</div>

Excellent, it works for me as well now. I changed mappings in my test script  
and had a bug there. Sorry about that.

On Mon, Aug 9, 2010 at 8:49 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> I've ran your script in the case and I do get back the terms for the index,  
> here is what I get:
> 
> {"error":"[foo]  
> missing"}{"ok":true,"acknowledged":true}{"ok":true,"acknowledged":true}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"1"}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"2"}{"ok":true,"\_index":"foo","\_type":"bar","\_id":"3"}{"ok":true,"\_shards":{"total":1,"successful":1,"failed":0}}{  
> "\_shards" : {  
> "total" : 1,  
> "successful" : 1,  
> "failed" : 0  
> },  
> "hits" : {  
> "total" : 3,  
> "max\_score" : 1.0,  
> "hits" :   
> },  
> "facets" : {  
> "type" : {  
> "\_type" : "terms",  
> "\_field" : "\_type",  
> "terms" : [ {  
> "term" : "bar",  
> "count" : 3  
> } ]  
> },  
> "index" : {  
> "\_type" : "terms",  
> "\_field" : "\_index",  
> "terms" : [ {  
> "term" : "foo",  
> "count" : 3  
> } ]  
> }  
> }  
> }
> 
> On Mon, Aug 9, 2010 at 9:46 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:
> 
> > So, I reindex my data and I can see with Luke that "\_index" field is in  
> > index now, cool. However, my query still returns empty terms : array for  
> > the "index" facet. What am I doing wrong? And am I using it correctly at  
> > all? Is "\_index" supposed to work the same way in facets as "\_type"?
> > 
> > Here is the query:
> > 
> > curl -XGET '[http://localhost:9200/foo/bar/\_search?pretty=1](http://localhost:9200/foo/bar/_search?pretty=1)' -d '  
> > {  
> > "size" : 1,  
> > "query" : { "match\_all":{}},  
> > "facets" : {  
> > "type" : {  
> > "terms" : { "field" : "\_type"}  
> > },  
> > "index" : {  
> > "terms" : { "field" : "\_index" }  
> > }  
> > }  
> > }'
> > 
> > Here is output:
> > 
> > {  
> > "\_shards" : {  
> > "total" : 1,  
> > "successful" : 1,  
> > "failed" : 0  
> > },  
> > "hits" : {  
> > "total" : 3,  
> > "max\_score" : 1.0,  
> > "hits" : [ {  
> > "\_index" : "foo",  
> > "\_type" : "bar",  
> > "\_id" : "1",  
> > "\_score" : 1.0, "\_source" : {"field1":"value1","field2":"1"}  
> > } ]  
> > },  
> > "facets" : {  
> > "type" : {  
> > "\_type" : "terms",  
> > "\_field" : "\_type",  
> > "terms" : [ {  
> > "term" : "bar",  
> > "count" : 3  
> > } ]  
> > },  
> > "index" : {  
> > "\_type" : "terms",  
> > "\_field" : "\_index",  
> > "terms" :   
> > }  
> > }  
> > }
> > 
> > On Mon, Aug 9, 2010 at 7:32 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:
> > 
> > > just pushed a fix for this, can you test it?
> > > 
> > > On Mon, Aug 9, 2010 at 5:13 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com)wrote:
> > > 
> > > > I attached test case into the ticket:  
> > > > [Add the ability to store the index name in the doc · Issue #292 · elastic/elasticsearch · GitHub](http://github.com/elasticsearch/elasticsearch/issues/issue/292)
> > > > 
> > > > Regards,  
> > > > Lukas

---

<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, 4:21am UTC](https://discuss.elastic.co/t/enabled--index-does-not-allow-me-to-get-facet-values/3200/6 "2017-07-06T04:21:00Z")

</div>


