Facets problem with capital letters

Hi,

I am getting the facets in a search, but I have a problem, the capital letters of the terms are always lowercase, so Elastic Search and the app I am trying to integrate can't understand each other (actually, the app can't understand ES).

I mean, I get something like

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myownfile","count":6},
{"term":"myarticle","count":2},
{"term":"mypost","count":1}
]}
}

when it should be

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myOwnFile","count":6},
{"term":"myArticle","count":2},
{"term":"myPost","count":1}
]}
}

I checked that I am storing "myOwnFile", "myArticle" and "myPost" from the app in ES.

How can I fix that?

Thanks!!

You have to change the mapping for these fields and for example use a Keyword analyzer: http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 15 févr. 2013 à 19:26, elastray adelpozo@xtivia.com a écrit :

Hi,

I am getting the facets in a search, but I have a problem, the capital
letters of the terms are always lowercase, so Elastic Search and the app I
am trying to integrate can't understand each other (actually, the app can't
understand ES).

I mean, I get something like

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myownfile","count":6},
{"term":"myarticle","count":2},
{"term":"mypost","count":1}
]}
}

when it should be

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myOwnFile","count":6},
{"term":"myArticle","count":2},
{"term":"myPost","count":1}
]}
}

I checked that I am storing "myOwnFile", "myArticle" and "myPost" from the
app in ES.

How can I fix that?

Thanks!!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Facets-problem-with-capital-letters-tp4029894.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

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

The problem is that sometimes I will be able to map them correctly but others it is going to be impossible.

Could it be fixed using templates?

(mappings and templates was what was left for the end )

Thanks!!

Not sure to understand your question here.

You can use multi field feature which is very cool for that.

Define whatever analyzer for your search and Keyword analyzer for facets.
And compute facets on yourfield.facet.

Does it help?

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 15 févr. 2013 à 19:35, David Pilato david@pilato.fr a écrit :

You have to change the mapping for these fields and for example use a Keyword analyzer: http://www.elasticsearch.org/guide/reference/index-modules/analysis/keyword-analyzer.html

HTH

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 15 févr. 2013 à 19:26, elastray adelpozo@xtivia.com a écrit :

Hi,

I am getting the facets in a search, but I have a problem, the capital
letters of the terms are always lowercase, so Elastic Search and the app I
am trying to integrate can't understand each other (actually, the app can't
understand ES).

I mean, I get something like

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myownfile","count":6},
{"term":"myarticle","count":2},
{"term":"mypost","count":1}
]}
}

when it should be

"facets":{
"name":{"_type":"terms","missing":0,"total":9,"other":0,"terms":[
{"term":"myOwnFile","count":6},
{"term":"myArticle","count":2},
{"term":"myPost","count":1}
]}
}

I checked that I am storing "myOwnFile", "myArticle" and "myPost" from the
app in ES.

How can I fix that?

Thanks!!

--
View this message in context: http://elasticsearch-users.115913.n3.nabble.com/Facets-problem-with-capital-letters-tp4029894.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

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

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

Perhaps the problem is that I am not sure if I understand the mappings.

What I am doing is replace Solr by ES. So I have the Solr schema and i have to create the mapping,

I have in Solr something like

description

with searchschemer I get

{
"mappings" : {
"type" : {
"properties" : {
"title" : { "type" : "string", "store" : "yes", "index" : "analyzed" },
"description" : { "type" : "string", "store" : "yes", "index" : "analyzed" }
},
"dynamic_templates" : [
{
"template_" : {
"match" : "*Name",
"match_mapping_type" : "string",
"mapping" : { "type" : "string", "store" : "yes", "index" : "not_analyzed" }
}
}
]
}
}
}

At this point, I do not understand

  1. What happens with defaultSearchField. Perhaps it doesn't matter.
  2. How I use the mapping? I don't get how map the type... I have a lot of different types of objects...
  3. What I do with the dynamic_templates.

Any help appreciated!!!
Regards!

Your issue is that the field you facet on needs to be not_analyzed, but
sometimes you need this field to be analyzed as well. David's suggestion of
multi field is the best solution:

http://www.elasticsearch.org/guide/reference/mapping/multi-field-type.html

Your mapping is syntactically correct, but needs to be modified. Are you
faceting on the dynamic fields? I have never tried, but multi fields should
work with dynamic templates.

"dynamic_templates": [
{
"template_": {
"match": "*Name",
"match_mapping_type": "string",
"mapping": {
"type": "multi_field",
"fields": {
"touched": { "type": "string", "index": "analyzed" },
"untouched": { "type": "string", "index": "not_analyzed" }
}
}
}
}
]

The field names will change, so you need to adjust your queries.

--
Ivan

On Fri, Feb 15, 2013 at 11:47 AM, elastray adelpozo@xtivia.com wrote:

Perhaps the problem is that I am not sure if I understand the mappings.

What I am doing is replace Solr by ES. So I have the Solr schema and i have
to create the mapping,

I have in Solr something like

description

with searchschemer I get

{
"mappings" : {
"type" : {
"properties" : {
"title" : { "type" : "string", "store" : "yes", "index" : "analyzed" },
"description" : { "type" : "string", "store" : "yes", "index" :
"analyzed"
}
},
"dynamic_templates" : [
{
"template_" : {
"match" : "*Name",
"match_mapping_type" : "string",
"mapping" : { "type" : "string", "store" : "yes", "index" :
"not_analyzed" }
}
}
]
}
}
}

At this point, I do not understand

  1. What happens with defaultSearchField. Perhaps it doesn't matter.
  2. How I use the mapping? I don't get how map the type... I have a lot of
    different types of objects...
  3. What I do with the dynamic_templates.

Any help appreciated!!!
Regards!

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Facets-problem-with-capital-letters-tp4029894p4029901.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.

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