I'm not quite getting the results I expect: I think I'm indexing the
way you suggested...
curl -XPUT localhost:9200/cars?pretty=true -d '{"index" :
{"analysis" : {"analyzer" : {"default" : {"type" : "keyword"}}}}}'
...because after populating ES, the following query gives me the fully-
retained fields:
curl -X POST "http://localhost:9200/cars/car/_search?
pretty=true&q=make:*" -d '{"size" : "0", "facets" : {"make" :
{ "terms" : {"field" : "make"} }}}'
I can even do a query now in which I ask for all "makes" that end in
"n"...
curl -X POST "http://localhost:9200/cars/car/_search?
pretty=true&q=make:*n" -d '{"size" : "0", "facets" : {"make" :
{ "terms" : {"field" : "make"} }}}'
...and I get the right result:
{
...
"facets" : {
"make" : {
"_type" : "terms",
"missing" : 0,
"total" : 3,
"other" : 0,
"terms" : [ {
"term" : "Aston Martin",
"count" : 2
}, {
"term" : "Nissan",
"count" : 1
} ]
}
}
}
However, if I ask for all "makes" that start with "a" or
"A" (q=make:A* or q=make:a*), I get no results (there should be
several--at least one as shown in the above example):
curl -X POST "http://localhost:9200/cars/car/_search?
pretty=true&q=make:a*" -d '{"size" : "0", "facets" : {"make" :
{ "terms" : {"field" : "make"} }}}'
Is that a bug, or is there something I'm missing?
thanks in advance, Chuck
On Feb 13, 9:33 am, Ivan Brusic i...@brusic.com wrote:
Hi Chuck,
When faceting on strings, they should either be not analyzed
(preferred) or tokenized with a KeywordTokenizer. What is happening in
yourcaseis the terms are being indexed as lowercase by the default
analyzer.
--
Ivan
On Mon, Feb 13, 2012 at 9:14 AM, csh chuck....@gmail.com wrote:
Is there a way to dofacetedsearches using the Search API AND
maintaincase. For example...
curl -X POST "http://localhost:9200/automobiles/automobile/_search?
pretty=true&q=make:B*" -d '{"size" : "0", "facets" : {"make" :
{ "terms" : {"field" : "make"} }}}'
...returns...
{
...
"facets" : {
"make" : {
...
"terms" : [ {
"term" : "bmw",
"count" : 1654
}, {
"term" : "buick",
"count" : 362
}, {
...
} ]
}
}
...but I want to retain thecase("BMW", "Buick").
Thanks in advance, Chuck