Hi,
I have the same problem as with Royce. I have the following mappings:
curl -XPOST "http://localhost:9200/pictures" -d '
{
"mappings" : {
"pictures" : {
"properties" : {
"id": { "type": "string" },
"description": {"type": "string", "index": "not_analyzed"},
"featured": { "type": "boolean" },
"categories": { "type": "string", "index": "not_analyzed" },
"tags": { "type": "string", "index": "not_analyzed",
"analyzer": "keyword" },
"created_at": { "type": "double" }
}
}
}
}'
And My Data is:
curl -X POST "http://localhost:9200/pictures/picture" -d '{
"picture": {
"id": "4defe0ecf02a8724b8000047",
"title": "Victoria Secret PhotoShoot",
"description": "From France and Italy",
"featured": true,
"categories": [
"Fashion",
"Girls",
],
"tags": [
"girl",
"photoshoot",
"supermodel",
"Victoria Secret"
],
"created_at": 1405784416.04672
}
}'
And My Query is:
curl -X POST "http://localhost:9200/pictures/_search?pretty=true" -d '
{
"query": {
"text": {
"tags": {
"query": "Victoria Secret"
}
}
},
"facets": {
"tags": {
"terms": {
"field": "tags"
}
}
}
}'
The Output result is:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" :
},
"facets" : {
"tags" : {
"_type" : "terms",
"missing" : 0,
"total" : 0,
"other" : 0,
"terms" :
}
}
}
So I got total 0 in facets and total: 0 in hits
Any Idea Why its not working? I know that when remove the keyword analyzer
from tags and make it "not_analyzed" then I get result but there is still a
problem of case insensitive.
Cheers!
Suraj
On Thursday, January 12, 2012 7:39:24 AM UTC+5:45, Ivan Brusic wrote:
The topic you referenced has the answer. If the field you are faceting
on is a string, then it needs to either be not analyzed or analyzed
with something like the KeywordAnalyzer which terms the term as a
single token. Can you gist the mapping you are using? In your example,
it appears that location is being analyzed and is indexed as two
tokens "Kansas" and "City", which is the default behavior. The facet
will treat the two tokens as unique terms.
Elasticsearch Platform — Find real-time answers at scale | Elastic
--
Ivan
Elasticsearch Platform — Find real-time answers at scale | Elastic
On Wed, Jan 11, 2012 at 10:01 AM, Royce <royce....@gmail.com <javascript:>>
wrote:
Hi,
I'm using facets to do filters on search results. One tag, for
example, is a city name "Kansas City." The facet interprets "Kansas
City" as two separate counts, "Kansas" and "City".
How can I configure facets to recognize "Kansas City" as one tag?
Take care,
Royce
--