Filters with analyzers


(narinder.izap) #1
 Hi Guys,

               I am having doubt if the filters by default use the 

analyzers and if they use, then which one and if i need to change it, how
to change the analyzer of the filter.

Actually I have a query as follows:

{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
[
{
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "ys: bay",
"analyzer": "simple"
}
}
}
]
]
}
},
"filter": {
"or": [
{
"prefix": {
"searchable.title": "ys: bay"
}
}
]
}
}
}
}

It is not giving results, but if i use the following query, it giving the
result:

{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
[
{
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "ys: bay",
"analyzer": "simple"
}
}
}
]
]
}
},
"filter": {
"or": [
{
"prefix": {
"searchable.title": "ys"
}
}
]
}
}
}
}

I think the *":" *is the reason, but i did not get any documentation
regarding the filters and analyzers together. So can you give me the way??


(Shay Banon) #2

Filters don't use analyzers at all.

On Friday, January 27, 2012 at 8:09 AM, Narinder Kaur wrote:

 Hi Guys,

               I am having doubt if the filters by default use the analyzers and if they use, then which one and if i need to change it, how to change the analyzer of the filter.

Actually I have a query as follows:

{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
[
{
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "ys: bay",
"analyzer": "simple"
}
}
}
]
]
}
},
"filter": {
"or": [
{
"prefix": {
"searchable.title": "ys: bay"
}
}
]
}
}
}
}

It is not giving results, but if i use the following query, it giving the result:

{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
[
{
"text": {
"searchable.title": {
"type": "phrase_prefix",
"query": "ys: bay",
"analyzer": "simple"
}
}
}
]
]
}
},
"filter": {
"or": [
{
"prefix": {
"searchable.title": "ys"
}
}
]
}
}
}
}

I think the ":" is the reason, but i did not get any documentation regarding the filters and analyzers together. So can you give me the way??


(narinder.izap) #3

then can you please explain the behaviour and suggest some solution for the
above problem??


(Shay Banon) #4

Hard to tell without understanding the data you index, and the analyzer used for each one, but maybe the title is analyzed?

On Saturday, January 28, 2012 at 12:30 PM, Narinder Kaur wrote:

then can you please explain the behaviour and suggest some solution for the above problem??


(system) #5