Hi.I'm having problems with term queries.I want to search with terms case in-sensitive.I found this post: http://elasticsearch-users.115913.n3.nabble.com/Mapping-not-analyzed-field-but-making-it-not-case-sensitive-td3537033.html, but I don't think it works for me.I'll put an example of my queries:1. Query for analyzed part, document value uppercased{ "query": { "term": { "personal.country": "country" } }}Returns document
2. Query for not analyzed part, doc value same as term value{ "query": { "term": { "device.brand": "Brand 1" } }}Returns document
3. Query for not analyzed part, term value starts with lower case{ "query": { "term": { "device.brand": "brand 1" } }}Do not retuns document as I would expect.
Is it possible to make a term query to not analyzed properties that will ignore case sensitivity?Is it problem with my configuration?
BR.
I'm using ES in 0.19.8.My data:{ "device":{ "brand": "Brand 1", "model": "bRAND 2" }, "personal": { "login": "login", "firstName": "first name", "lastName": "last name", "address": "address", "zipCode": "zip code", "city": "city", "country": "COUNTRY", "language": "LanGuage" }}
My ES config:index: analysis: analyzer: string_lowercase: tokenizer: keyword filter: lowercaseES Mapping:{"mappings":{ "subscriber": { "properties": { "device":{ "type": "object", "properties": { "brand": { "type": "string", "index" : "not_analyzed", "analyzer" : "string_lowercase" }, "model": { "type": "string", "index" : "not_analyzed", "analyzer" : "string_lowercase" } } }, "personal": { "type": "object", "properties": { "login": { "type": "string" }, "firstName": { "type": "string" }, "lastName": { "type": "string" }, "address": { "type": "string" }, "zipCode": { "type": "string" }, "city": { "type": "string" }, "country": { "type": "string" }, "language": { "type": "string" } } } } } }}
Your fields should now be "analyzed" (using the specified analyzer) and not
"not_analyzed".
--
Ivan
On Aug 2, 2012 5:11 AM, "misiek jendryszka" oniron9th@hotmail.com wrote:
Hi.
I'm having problems with term queries.
I want to search with terms case in-sensitive.
I found this post:
http://elasticsearch-users.115913.n3.nabble.com/Mapping-not-analyzed-field-but-making-it-not-case-sensitive-td3537033.html,
but I don't think it works for me.
I'll put an example of my queries:
Query for analyzed part, document value uppercased
{
"query": {
"term": {
"personal.country": "country"
}
}
}
Returns documentQuery for not analyzed part, doc value same as term value
{
"query": {
"term": {
"device.brand": "Brand 1"
}
}
}
Returns documentQuery for not analyzed part, term value starts with lower case
{
"query": {
"term": {
"device.brand": "brand 1"
}
}
}
Do not retuns document as I would expect.Is it possible to make a term query to not analyzed properties that will
ignore case sensitivity?
Is it problem with my configuration?BR.
I'm using ES in 0.19.8.
My data:
{
"device":{
"brand": "Brand 1",
"model": "bRAND 2"
},
"personal": {
"login": "login",
"firstName": "first name",
"lastName": "last name",
"address": "address",
"zipCode": "zip code",
"city": "city",
"country": "COUNTRY",
"language": "LanGuage"
}
}My ES config:
index:
analysis:
analyzer:
string_lowercase:
tokenizer: keyword
filter: lowercase
ES Mapping:
{"mappings":{
"subscriber": {
"properties": {
"device":{
"type": "object",
"properties": {
"brand": {
"type": "string",
"index" : "not_analyzed",
"analyzer" : "string_lowercase"
},
"model": {
"type": "string",
"index" : "not_analyzed",
"analyzer" : "string_lowercase"
}
}
},
"personal": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"address": {
"type": "string"
},
"zipCode": {
"type": "string"
},
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"language": {
"type": "string"
}
}
}
}
}
}
}
I sse Your point
I can always write custom analyzer for some fields.
Thanks
Hi michalj,
Can you please share the custom analyzer for this case.
Thanks
Hi michalj,
Can you please share the custom analyzer for this case? Its not working as
I have tried every way to get the facted search with case insensitive.
Thanks
On Thursday, August 2, 2012 5:56:51 PM UTC+5:45, misiek jendryszka wrote:
Hi.
I'm having problems with term queries.
I want to search with terms case in-sensitive.
I found this post:
http://elasticsearch-users.115913.n3.nabble.com/Mapping-not-analyzed-field-but-making-it-not-case-sensitive-td3537033.html,
but I don't think it works for me.
I'll put an example of my queries:
Query for analyzed part, document value uppercased
{
"query": {
"term": {
"personal.country": "country"
}
}
}
Returns documentQuery for not analyzed part, doc value same as term value
{
"query": {
"term": {
"device.brand": "Brand 1"
}
}
}
Returns documentQuery for not analyzed part, term value starts with lower case
{
"query": {
"term": {
"device.brand": "brand 1"
}
}
}
Do not retuns document as I would expect.Is it possible to make a term query to not analyzed properties that will
ignore case sensitivity?
Is it problem with my configuration?BR.
I'm using ES in 0.19.8.
My data:
{
"device":{
"brand": "Brand 1",
"model": "bRAND 2"
},
"personal": {
"login": "login",
"firstName": "first name",
"lastName": "last name",
"address": "address",
"zipCode": "zip code",
"city": "city",
"country": "COUNTRY",
"language": "LanGuage"
}
}My ES config:
index:
analysis:
analyzer:
string_lowercase:
tokenizer: keyword
filter: lowercase
ES Mapping:
{"mappings":{
"subscriber": {
"properties": {
"device":{
"type": "object",
"properties": {
"brand": {
"type": "string",
"index" : "not_analyzed",
"analyzer" : "string_lowercase"
},
"model": {
"type": "string",
"index" : "not_analyzed",
"analyzer" : "string_lowercase"
}
}
},
"personal": {
"type": "object",
"properties": {
"login": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"address": {
"type": "string"
},
"zipCode": {
"type": "string"
},
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"language": {
"type": "string"
}
}
}
}
}
}
}
--
Suraj,
He already did in his original post. It is called string_lowercase.
--
Ivan
On Sun, Aug 19, 2012 at 9:42 PM, Suraj surajyonzon@gmail.com wrote:
Hi michalj,
Can you please share the custom analyzer for this case.
Thanks--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Term-query-case-insensitive-tp4021165p4021894.html
Sent from the Elasticsearch Users mailing list archive at Nabble.com.--
--