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


(Lukáš Vlček) #1

I attached test case into the ticket:

Regards,
Lukas


(Shay Banon) #2

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 wrote:

I attached test case into the ticket:
http://github.com/elasticsearch/elasticsearch/issues/issue/292

Regards,
Lukas


(Lukáš Vlček) #3

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' -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.comwrote:

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 wrote:

I attached test case into the ticket:
http://github.com/elasticsearch/elasticsearch/issues/issue/292

Regards,
Lukas


(Shay Banon) #4

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 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' -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.comwrote:

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

I attached test case into the ticket:
http://github.com/elasticsearch/elasticsearch/issues/issue/292

Regards,
Lukas


(Lukáš Vlček) #5

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

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 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' -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.comwrote:

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

I attached test case into the ticket:
http://github.com/elasticsearch/elasticsearch/issues/issue/292

Regards,
Lukas


(system) #6