Boolean matchQuery on a not_analyzed field?

having a very strange problem and hoping the group can provide some
enlightenment. I have a field, activeLabels, which is defined as a
multi-field in my index, with analyzed and not_analyzed subfields.

A boolean query I have is matching as I expect when I use the analyzed
field, but when I switch to using the not_analyzed field, I no longer get a
match, although the string values match exactly. here's the sub-query:
{
"bool" : {
"must" : {
"bool" : {
"should" : {
"match" : {
"activeLabels_not_analyzed" : {
"query" : "test1",
"type" : "boolean",
"operator" : "OR"
} } } } } } }

Am I missing something about the way not analyzed fields are used vs
analyzed?

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

Maybe try:

"activeLabels*.*not_analyzed"

        "activeLabels_not_analyzed" : {

Am I missing something about the way not analyzed fields are used vs
analyzed?

In other words, the dot and not the underscore is the field name scoping
"operator".

Hope this helps!

Brian

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

Hi Brian,
the subfield is actually named with the underscore, although you are
right, I should have included the prefix. Alas, I tried it again with

"match" : {
"activeLabels.activeLabels_not_analyzed" : {
"query" : "test1",
"type" : "boolean",
"operator" : "OR"
}

and still no dice :(.

On Monday, September 30, 2013 11:32:25 AM UTC-4, InquiringMind wrote:

Maybe try:

"activeLabels*.*not_analyzed"

        "activeLabels_not_analyzed" : {

Am I missing something about the way not analyzed fields are used vs
analyzed?

In other words, the dot and not the underscore is the field name scoping
"operator".

Hope this helps!

Brian

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

(Second attempt to post this: Chrome is garbage and lost the first attempt.)

Here are my settings and mappings:

{
"settings" : {
"index" : {
"number_of_shards" : 1,
"refresh_interval" : "1s",
"analysis" : {
"char_filter" : { },
"filter" : {
"english_snowball_filter" : {
"type" : "snowball",
"language" : "English"
}
},
"analyzer" : {
"english_stemming_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding",
"english_snowball_filter" ]
},
"english_standard_analyzer" : {
"type" : "custom",
"tokenizer" : "standard",
"filter" : [ "standard", "lowercase", "asciifolding" ]
}
}
}
}
},
"mappings" : {
"ghost" : {
"_all" : {
"enabled" : false
},
"_ttl" : {
"enabled" : true,
"default" : "1.9m"
},
"properties" : {
"cn" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer"
},
"text" : {
"type" : "multi_field",
"fields" : {
"text" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer",
"position_offset_gap" : 4
},
"std" : {
"type" : "string",
"analyzer" : "english_standard_analyzer",
"position_offset_gap" : 4
},
"na" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
},
"elf" : {
"_all" : {
"enabled" : false
},
"_ttl" : {
"enabled" : true
},
"properties" : {
"cn" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer"
},
"text" : {
"type" : "multi_field",
"fields" : {
"text" : {
"type" : "string",
"analyzer" : "english_stemming_analyzer",
"position_offset_gap" : 4
},
"std" : {
"type" : "string",
"analyzer" : "english_standard_analyzer",
"position_offset_gap" : 4
},
"na" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
}

Here is a query to the text field:

{
"bool" : {
"must" : {
"match" : {
"text" : {
"query" : "lives",
"type" : "boolean"
}
}
}
}
}

Here is a query to the text.na field which is not_analyzed:

{
"bool" : {
"must" : {
"match" : {
"text.na" : {
"query" : "Lives forever",
"type" : "boolean"
}
}
}
}
}

And here are the two documents that are returned from each of the above
queries:

On Monday, September 30, 2013 12:50:01 PM UTC-4, Paul Sanwald wrote:

Hi Brian,
the subfield is actually named with the underscore, although you are
right, I should have included the prefix. Alas, I tried it again with

"match" : {
"activeLabels.activeLabels_not_analyzed" : {
"query" : "test1",
"type" : "boolean",
"operator" : "OR"
}

and still no dice :(.

On Monday, September 30, 2013 11:32:25 AM UTC-4, InquiringMind wrote:

Maybe try:

"activeLabels*.*not_analyzed"

        "activeLabels_not_analyzed" : {

Am I missing something about the way not analyzed fields are used vs
analyzed?

In other words, the dot and not the underscore is the field name scoping
"operator".

Hope this helps!

Brian

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

And here are the two documents that are returned from each of the above
queries:

{ "_index" : "mortal" , "_type" : "elf" , "_id" : "1" , "_version" : 1 ,
"_score" : 2.982867956161499 , "_source" : { "cn" : "Celeborn" , "text" :
"Lives forever" } }
{ "_index" : "mortal" , "_type" : "elf" , "_id" : "2" , "_version" : 1 ,
"_score" : 2.982867956161499 , "_source" : { "cn" : "Galadriel" , "text" :
"Lives forever" } }

(This second rewrite missed a few things that were in the first one....)

Also, here is a phrase query that also worked and returned the two
documents:

{
"bool" : {
"must" : {
"match" : {
"text" : {
"query" : "lives forever",
"type" : "phrase",
"slop" : 0
}
}
}
}
}

Hope this helps!

Brian

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

Brian,
thanks, this does help. The issue I was seeing ended up being around
timing, the query worked correctly but I was running it from a java
integration test and the index wasn't updating by the time the assert I was
using was being called. so, I was seeing inconsistent behavior.

thanks for the detailed example, your help is much appreciated!

On Tue, Oct 1, 2013 at 11:35 AM, InquiringMind brian.from.fl@gmail.comwrote:

And here are the two documents that are returned from each of the above
queries:

{ "_index" : "mortal" , "_type" : "elf" , "_id" : "1" , "_version" : 1 ,
"_score" : 2.982867956161499 , "_source" : { "cn" : "Celeborn" , "text" :
"Lives forever" } }
{ "_index" : "mortal" , "_type" : "elf" , "_id" : "2" , "_version" : 1 ,
"_score" : 2.982867956161499 , "_source" : { "cn" : "Galadriel" , "text" :
"Lives forever" } }

(This second rewrite missed a few things that were in the first one....)

Also, here is a phrase query that also worked and returned the two
documents:

{
"bool" : {
"must" : {
"match" : {
"text" : {
"query" : "lives forever",
"type" : "phrase",
"slop" : 0
}
}
}
}
}

Hope this helps!

Brian

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

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