Facet filtering on strings with special characters


(Alex Malgaroli) #1

Hi all,

I am working with a mapping and data structure that's mostly similar to the
one described here: https://gist.github.com/zwrss/5188008
(my use case is also similar to what lead to that gist, check the entire
topic here
https://groups.google.com/d/topic/elasticsearch/fK08asuV7y8/discussion,
basically I'm following Clinton Gormley's suggestion)

Point is that when I try to run a facet like this one:
"type" : {
"terms" : { "field" : "type" },
"facet_filter" : {
"and" : [
{ "term" : { "characteristics" : "warranty_3 years" } },
]
}
},

I always get 0 result. It seems like the "_" gets tokenized and removed
when searching as if the field were analyzed. The mapping for the
characteristics field it's tyoe: string, index: "not_analyzed".

Any idea what could be possibly wrong?

Thanks in advance.

AM

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Ivan Brusic) #2

The term in a term filter is never analyzed, regardless of the analyzer set
on the field.

When you say that you get 0 results, does that mean your query gets zero
results or there are no entries in the facet? What happens when you do not
apply the facet filter?

On Thu, Oct 31, 2013 at 9:50 AM, Alex Malgaroli alex.malgaroli@gmail.comwrote:

Hi all,

I am working with a mapping and data structure that's mostly similar to
the one described here: https://gist.github.com/zwrss/5188008
(my use case is also similar to what lead to that gist, check the entire
topic here
https://groups.google.com/d/topic/elasticsearch/fK08asuV7y8/discussion,
basically I'm following Clinton Gormley's suggestion)

Point is that when I try to run a facet like this one:
"type" : {
"terms" : { "field" : "type" },
"facet_filter" : {
"and" : [
{ "term" : { "characteristics" : "warranty_3 years" } },
]
}
},

I always get 0 result. It seems like the "_" gets tokenized and removed
when searching as if the field were analyzed. The mapping for the
characteristics field it's tyoe: string, index: "not_analyzed".

Any idea what could be possibly wrong?

Thanks in advance.

AM

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Alex Malgaroli) #3

HI Ivan.
I made again some experiments and actually I got the expected results.
There may have been a typo in the query or filter on my part which I didn't
see.

Sorry for the inconvenience

AM

On Fri, Nov 1, 2013 at 1:07 AM, Ivan Brusic ivan@brusic.com wrote:

The term in a term filter is never analyzed, regardless of the analyzer
set on the field.

When you say that you get 0 results, does that mean your query gets zero
results or there are no entries in the facet? What happens when you do not
apply the facet filter?

On Thu, Oct 31, 2013 at 9:50 AM, Alex Malgaroli alex.malgaroli@gmail.comwrote:

Hi all,

I am working with a mapping and data structure that's mostly similar to
the one described here: https://gist.github.com/zwrss/5188008
(my use case is also similar to what lead to that gist, check the entire
topic here
https://groups.google.com/d/topic/elasticsearch/fK08asuV7y8/discussion,
basically I'm following Clinton Gormley's suggestion)

Point is that when I try to run a facet like this one:
"type" : {
"terms" : { "field" : "type" },
"facet_filter" : {
"and" : [
{ "term" : { "characteristics" : "warranty_3 years" } },
]
}
},

I always get 0 result. It seems like the "_" gets tokenized and removed
when searching as if the field were analyzed. The mapping for the
characteristics field it's tyoe: string, index: "not_analyzed".

Any idea what could be possibly wrong?

Thanks in advance.

AM

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

For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/P2UZfnWiV14/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--

Taxation is just a sophisticated way of demanding money with menaces
[Terry Pratchett, Night Watch]

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4