It was my mistake, the field I was trying to do an aggregation was mapped double, I assumed its a string, after seeing some sample documents with strings..
Why didn't es throw an error when I'm indexing docs with strings instead of double..? On Thursday, February 19, 2015 at 1:35:08 PM UTC+5:30, David Pilato wrote: > > Did you apply your analyzer to your mapping? > > David > > Le 19 févr. 2015 à 08:53, Anil Karaka <anilk...@gmail.com <javascript:>> > a écrit : > > > http://stackoverflow.com/questions/28601082/terms-aggregation-failing-on-string-fields-with-a-custom-analyzer-in-elasticsear > > Posted in stack over flow as well.. > > On Thursday, February 19, 2015 at 1:01:40 PM UTC+5:30, Anil Karaka wrote: >> >> I wanted a custom analyzer that behaves exactly like not_analyzed, except >> that fields are case insensitive.. >> >> I have my analyzer as below, >> >> "index": { >> "analysis": { >> "analyzer": { // Custom Analyzer with keyword tokenizer and >> lowercase filter, same as not_analyzed but case insensitive >> "case_insensitive_keyword_analyzer": { >> "tokenizer": "keyword", >> "filter": "lowercase" >> } >> } >> } >> } >> >> But when I'm trying to do term aggregation over a field with strings >> analyzed as above, I'm getting this error.. >> >> { >> "error" >> :"ClassCastException[org.elasticsearch.search.aggregations.bucket.terms.DoubleTerms$Bucket >> cannot be cast to >> org.elasticsearch.search.aggregations.bucket.terms.StringTerms$Bucket]", >> "status" : 500 >> } >> >> Are there additional settings that I have to update in my custom analyzer >> for my terms aggregation to work..? >> >> >> The better question is I want a custom analyzer that does everything similar >> to not_analyzed but is case insensitive.. How do I achieve that? >> >> >> >> -- > 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 <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/91eea272-2f5e-4d9a-b975-dae5d50cd0d3%40googlegroups.com > > <https://groups.google.com/d/msgid/elasticsearch/91eea272-2f5e-4d9a-b975-dae5d50cd0d3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/46135e6f-6946-41bd-a562-557737192a07%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.