Case Insensitive Term Filters

I have created an analyzer that should simply lowercase a field. I do this
because I want to be able to filter on full phrases in this field ( eg,
north dakota ).

My problem is that when I perform a filter against this field, the search
phrase must now be lowercased. ( eg. "north dakota" works, but "North
Dakota" does not ).

Must I lowercase the filter phrase on my application end, or is there a way
to have Elasticsearch do it when a search is performed?

INDEX
{
"index" : {
"number_of_shards" : 5,
"number_of_replicas" : 1,
"analysis" : {
"analyzer" : {
"string_lowercase" : {
"tokenizer" : "keyword",
"filter" : "lowercase"
}
}
}
}
}

MAPPING
{
"company" : {
"properties" : {
"locations" : {
"type" : "nested",
"include_in_root" : true,
"properties" : {
"state" : {
"type" : "string",
"index" : "analyzed",
"analyzer" : "string_lowercase",
"include_in_all" : true
}
}
}
}
}
}

QUERY
{
"query": {
"filtered": {
"filter": {
"term": {
"locations.city": "Port washington"
}
},
"query": {
"match_all": []
}
}
}
}

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

If you need Elasticsearch to analyze your query, use a MatchQuery wrapped in a QueryFilter.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 30 mai 2013 à 04:36, Brian Jones tbrianjones@gmail.com a écrit :

I have created an analyzer that should simply lowercase a field. I do this because I want to be able to filter on full phrases in this field ( eg, north dakota ).

My problem is that when I perform a filter against this field, the search phrase must now be lowercased. ( eg. "north dakota" works, but "North Dakota" does not ).

Must I lowercase the filter phrase on my application end, or is there a way to have Elasticsearch do it when a search is performed?

INDEX
{
"index" : {
"number_of_shards" : 5,
"number_of_replicas" : 1,
"analysis" : {
"analyzer" : {
"string_lowercase" : {
"tokenizer" : "keyword",
"filter" : "lowercase"
}
}
}
}
}

MAPPING
{
"company" : {
"properties" : {
"locations" : {
"type" : "nested",
"include_in_root" : true,
"properties" : {
"state" : {
"type" : "string",
"index" : "analyzed",
"analyzer" : "string_lowercase",
"include_in_all" : true
}
}
}
}
}
}

QUERY
{
"query": {
"filtered": {
"filter": {
"term": {
"locations.city": "Port washington"
}
},
"query": {
"match_all": []
}
}
}
}

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