Mapping not analyzed field, but making it not case sensitive

Hello, I'm trying to migrate from Solr, but I'm having trouble
understanding mapping in ES.
I need to have just a plain string field for things like user name or
category name. But it could be not case sensetive.
So if I have a field with value like "userName":"Eugene Strokin" the
document should be returned in search like this: "userName":"eugene
strokin", as well as "userName":"EUGENE Strokin", and
"userName":"EugEne StrOKin"
I've put a mapping file with field description:
"userName":{"type":"string", index:"not_analyzed"},
But of course it is case sensitive.
So, query like this will not return anything:
{
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"term" : {
"userName" : "tessa"
}
}
}
}
if user name spelled using wrong case.
Could you please let me know how to mapped not case sensitive strings?

Thank you,
Eugene S.

You can configure an analyzer with keyword tokenizer and lowercase filter,
call it "keyword_lowercase" or something similar, and then, map the
relevant fields with this analyzer.

On Fri, Nov 25, 2011 at 11:42 PM, Eugene Strokin eugene@strokin.infowrote:

Hello, I'm trying to migrate from Solr, but I'm having trouble
understanding mapping in ES.
I need to have just a plain string field for things like user name or
category name. But it could be not case sensetive.
So if I have a field with value like "userName":"Eugene Strokin" the
document should be returned in search like this: "userName":"eugene
strokin", as well as "userName":"EUGENE Strokin", and
"userName":"EugEne StrOKin"
I've put a mapping file with field description:
"userName":{"type":"string", index:"not_analyzed"},
But of course it is case sensitive.
So, query like this will not return anything:
{
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"term" : {
"userName" : "tessa"
}
}
}
}
if user name spelled using wrong case.
Could you please let me know how to mapped not case sensitive strings?

Thank you,
Eugene S.

Is anyway to define this new type on some configuration file?
I'm trying to put:
index :
analysis:
analyzer:
string_lowercase:
tokenizer : keyword
filter : lowercase

in config/elasticsearch.yml file which is under config folder, but I
keep getting
Caused by: org.elasticsearch.index.mapper.MapperParsingException: No
handler for type [string_lowercase] declared on field [screenName]

Thank you,
E.S.

On Nov 28, 6:58 am, Shay Banon kim...@gmail.com wrote:

You can configure an analyzer with keyword tokenizer and lowercase filter,
call it "keyword_lowercase" or something similar, and then, map the
relevant fields with this analyzer.

On Fri, Nov 25, 2011 at 11:42 PM, Eugene Strokin eug...@strokin.infowrote:

Hello, I'm trying to migrate from Solr, but I'm having trouble
understanding mapping in ES.
I need to have just a plain string field for things like user name or
category name. But it could be not case sensetive.
So if I have a field with value like "userName":"Eugene Strokin" the
document should be returned in search like this: "userName":"eugene
strokin", as well as "userName":"EUGENE Strokin", and
"userName":"EugEne StrOKin"
I've put a mapping file with field description:
"userName":{"type":"string", index:"not_analyzed"},
But of course it is case sensitive.
So, query like this will not return anything:
{
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"term" : {
"userName" : "tessa"
}
}
}
}
if user name spelled using wrong case.
Could you please let me know how to mapped not case sensitive strings?

Thank you,
Eugene S.

Seems to work: config · GitHub. Are you sure you configured
the yml correctly?

On Tue, Nov 29, 2011 at 2:40 AM, Eugene Strokin eugene@strokin.info wrote:

Is anyway to define this new type on some configuration file?
I'm trying to put:
index :
analysis:
analyzer:
string_lowercase:
tokenizer : keyword
filter : lowercase

in config/elasticsearch.yml file which is under config folder, but I
keep getting
Caused by: org.elasticsearch.index.mapper.MapperParsingException: No
handler for type [string_lowercase] declared on field [screenName]

Thank you,
E.S.

On Nov 28, 6:58 am, Shay Banon kim...@gmail.com wrote:

You can configure an analyzer with keyword tokenizer and lowercase
filter,
call it "keyword_lowercase" or something similar, and then, map the
relevant fields with this analyzer.

On Fri, Nov 25, 2011 at 11:42 PM, Eugene Strokin <eug...@strokin.info
wrote:

Hello, I'm trying to migrate from Solr, but I'm having trouble
understanding mapping in ES.
I need to have just a plain string field for things like user name or
category name. But it could be not case sensetive.
So if I have a field with value like "userName":"Eugene Strokin" the
document should be returned in search like this: "userName":"eugene
strokin", as well as "userName":"EUGENE Strokin", and
"userName":"EugEne StrOKin"
I've put a mapping file with field description:
"userName":{"type":"string", index:"not_analyzed"},
But of course it is case sensitive.
So, query like this will not return anything:
{
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"term" : {
"userName" : "tessa"
}
}
}
}
if user name spelled using wrong case.
Could you please let me know how to mapped not case sensitive strings?

Thank you,
Eugene S.

HI Kimchy,
I tried your gist and it gave me following exception

{"error":"RemoteTransportException[[Banner, Robert
Bruce][inet[/192.168.1.15:9300]][indices/create]]; nested:
MapperParsingException[mapping [type1]]; nested:
MapperParsingException[Analyzer [string_lowercase] not found for field
[field1]];

I first created the analyzer in the elasticsearch.yml ,as provided in your
gist, and after that I created the mapping. Please let me know what I am
doing wrong.

On Tuesday, 29 November 2011 13:15:40 UTC+5:30, kimchy wrote:

Seems to work: config · GitHub. Are you sure you
configured the yml correctly?

On Tue, Nov 29, 2011 at 2:40 AM, Eugene Strokin eugene@strokin.infowrote:

Is anyway to define this new type on some configuration file?
I'm trying to put:
index :
analysis:
analyzer:
string_lowercase:
tokenizer : keyword
filter : lowercase

in config/elasticsearch.yml file which is under config folder, but I
keep getting
Caused by: org.elasticsearch.index.mapper.MapperParsingException: No
handler for type [string_lowercase] declared on field [screenName]

Thank you,
E.S.

On Nov 28, 6:58 am, Shay Banon kim...@gmail.com wrote:

You can configure an analyzer with keyword tokenizer and lowercase
filter,
call it "keyword_lowercase" or something similar, and then, map the
relevant fields with this analyzer.

On Fri, Nov 25, 2011 at 11:42 PM, Eugene Strokin <eug...@strokin.info
wrote:

Hello, I'm trying to migrate from Solr, but I'm having trouble
understanding mapping in ES.
I need to have just a plain string field for things like user name or
category name. But it could be not case sensetive.
So if I have a field with value like "userName":"Eugene Strokin" the
document should be returned in search like this: "userName":"eugene
strokin", as well as "userName":"EUGENE Strokin", and
"userName":"EugEne StrOKin"
I've put a mapping file with field description:
"userName":{"type":"string", index:"not_analyzed"},
But of course it is case sensitive.
So, query like this will not return anything:
{
"filtered" : {
"query" : {
"match_all" : {
}
},
"filter" : {
"term" : {
"userName" : "tessa"
}
}
}
}
if user name spelled using wrong case.
Could you please let me know how to mapped not case sensitive strings?

Thank you,
Eugene S.