500 "Number format exception" on Terms Aggregation

Hi All,

I'm facing a strange error while running a terms aggregation over what is
supposed to be a field with type "short".

Error:
RemoteTransportException[[][search/phase/query]]; nested:
ElasticsearchException[java.lang.NumberFormatException: Invalid shift value
in prefixCoded bytes (is encoded value really an INT?)]; nested:
UncheckedExecutionException[java.lang.NumberFormatException: Invalid shift
value in prefixCoded bytes (is encoded value really an INT?)]; nested:
NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded
value really an INT?)]; }]"

Here is my query.

GET cuevents-2014.35/_search?search_type=count
{
"query": {
"term": {
"event": {
"value": "unique_view"
}
}
},
"aggs": {
"Site_name": {
"terms": {
"field": "session_depth",
"size": 10
}
}
}
}

Here is a mapping of the field that causes the error, against all types in
the index.

{
"cuevents-2014.35" : {
"mappings" : {
"logs" : {
"session_depth" : {
"full_name" : "session_depth",

  •      "mapping":{"session_depth":{"type":"short"}}*
      }
    }
    
    }
    }
    }

From what I've been able to find online, that error can be thrown if you
have a field with the same name, in two different types, with different
definitions, in the same index.

e.g.
"logs" : {
"session_depth" : {
"type":"short"
}
}
"trees" : {
"session_depth" : {
"type":"string"
}
}

I found that I did in fact have my session_depth field defined differently
within two types of the same index. So, I deleted all documents of the
type that was incorrect. I also performed an optimization on the index,
hoping it would purge the deleted documents. However, I'm still receiving
the error above.

Does anyone know if I need to take any additional steps to remove the
documents marked for deletion, or if something else would cause the 500
error?

Thanks!

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c7eb5386-3c8b-4140-8b42-811f3c8a5feb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

I had exactly the same issue and was annoyed when I finally understood why it happened.

Anyway, I deleted all the documents containing the wrong type and made an _optimize?max_num_segments=1 and everything works well now :slight_smile: