Quantcast

Facets problem with capital letters

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Facets problem with capital letters

elastray
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!!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facets problem with capital letters

dadoonet
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



Le 15 févr. 2013 à 19:26, elastray <[hidden email]> 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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facets problem with capital letters

elastray
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!!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facets problem with capital letters

dadoonet
In reply to this post by dadoonet
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



Le 15 févr. 2013 à 19:35, David Pilato <[hidden email]> 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



Le 15 févr. 2013 à 19:26, elastray <[hidden email]> 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 [hidden email].
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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facets problem with capital letters

elastray
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

<field name="title" type="text" indexed="true" stored="true" />
<field name="description" type="text" indexed="true" stored="true" />
<dynamicField name="*Name" type="string" indexed="true" multiValued="true" stored="true" />
<defaultSearchField>description</defaultSearchField>

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!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Facets problem with capital letters

Ivan Brusic
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:


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 <[hidden email]> 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

<field name="title" type="text" indexed="true" stored="true" />
<field name="description" type="text" indexed="true" stored="true" />
<dynamicField name="*Name" type="string" indexed="true" multiValued="true"
stored="true" />
<defaultSearchField>description</defaultSearchField>

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 [hidden email].
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Loading...