When trying to search for data through spring-data-elasticsearch (see below for an example) but the data class it's supposed to create instances of happens to have an id field, spring-data-elasticsearch will use the _id field of the document instead of the id field of the source, which in this example will result in a NumberFormatException (see attachment for exception) since the class id field is an integer, while the elasticsearch "_id" field is not (even the "id" field in the mapping of elasticsearch is an integer). I'm not entirely sure if this is what actually happens, but it very much seems like it.
This is what spring should deserialize the searchhits from elasticsearch to (Yes, it combines jpa with elasticsearch, haven't had an issue with that yet though).
Basically this error comes from a - sorry to say that - misuse of the id property of the entity. When you define a property as id-property - and in Spring Data Elasticsearch this is done by annotating the property with @Id or naming it "id" - this property is marked to be used as identifier in Elasticsearch, when indexing a document, when deleting or updating a document.
The program that stores the entries in Elasticsearch should have used the value of the id property (123) to index this document, but instead, no id was set and so Elasticsearch assigned a String value "CaFHtHMBfczCkwGFm0zd" as identifier.
In Spring Data Elasticsearch 3.2x when reading the search results, the _id property was not used to fill the entity properties, rather the code was relying on the id property being in the source. So you could read in these objects.
In Spring Data Elasticsearch 4.0 the value of the Elasticsearch _id is set into the id-property, because this is the property that is explicitly marked to contain this id. And this leads to this error, because the types don't match.
I can - and will - change the code, so that the value of the property is taken from the _source (in your case the numeric value) and only if that is not available, the _id is taken - and then the type must match.
So while this will solve your issue, please keep in mind that your setup is an accident waiting to happen (and it did already). You don't have the Elasticsearch id in your entities, you cannot update or delete them and you can even get multiple documents from a search that have the same id value.
The good thing with Spring Data Elasticsearch is, that you get instances of SearchHit from the queries, and these return both the object and the Elasticsearch id, in my sample program this looks like (after committing my fix)