Elasticsearch term facet not showing negative terms

Showing 1-4 of 4 messages
Elasticsearch term facet not showing negative terms Maaz 3/26/13 11:08 AM

I am using elastic search term facets, My field contains some negative values but the facet is ignoring the negative sign

following is the facet query

http://myserver.com:9200/index/type/_search

Get/Post body

{
  "facets" : {
    "school.id" : {
      "terms" : {
        "field" : "school.id",
        "size" : 10
      }
    }
  }
}

Response

{
    "took": 281,
    "timed_out": false,
    "_shards": {
        "total": 5,
        "successful": 5,
        "failed": 0
    },
    "facets": {
        "school.id": {
            "_type": "terms",
            "missing": 302,
            "total": 4390,
            "other": 0,
            "terms": [
                {
                    "term": "1113515007867355135",
                    "count": 4390
                }
            ]
        }
    }
}

The actual value of id is -1113515007867355135, am I doing something wrong or do I need to pass anything to include negative sign (stemming issue)?

Re: Elasticsearch term facet not showing negative terms David Pilato 3/26/13 11:14 AM
Have a look at how ES analyzed your field.

curl -XGET 'localhost:9200/_analyze?analyzer=standard&pretty' -d '-1113515007867355135'
{
  "tokens" : [ {
    "token" : "1113515007867355135",
    "start_offset" : 1,
    "end_offset" : 20,
    "type" : "<NUM>",
    "position" : 1
  } ]
}

You should modify your mapping for this field and use for example a keyword analyzer
curl -XGET 'localhost:9200/_analyze?analyzer=keyword&pretty' -d '-1113515007867355135'
{
  "tokens" : [ {
    "token" : "-1113515007867355135",
    "start_offset" : 0,
    "end_offset" : 20,
    "type" : "word",
    "position" : 1
  } ]
}

HTH
-- 
David Pilato | Technical Advocate | Elasticsearch.com



Le 26 mars 2013 à 19:08, Maaz Bin Tariq <maa...@gmail.com> a écrit :

--
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 elasticsearc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Elasticsearch term facet not showing negative terms Maaz 3/26/13 10:48 PM
Thanks, but does it require reindexing all data as well?

--
You received this message because you are subscribed to a topic in the Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elasticsearch/FeObbeT1eok/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to elasticsearc...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: Elasticsearch term facet not showing negative terms David Pilato 3/26/13 10:50 PM
Yes.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


Le 27 mars 2013 à 06:48, Maaz Bin Tariq <maa...@gmail.com> a écrit :