Description
If you write a single java.lang.Byte type via json, it can't be read back.
The following error occurs:
Failed to execute phase [query_fetch], total failure; shardFailures {RemoteTransportException[[Spot][inet[/192.168.0.124:9300]][search/phase/query+fetch]]; nested: IOException[Can't write type [class java.lang.Byte]]; }
The following code produces the error:
Index-Mapping (template)
...
"ct" : {
"type" : "byte",
"store" : "yes",
"index" : "no"
}
...
Writing the document:
XContentBuilder jsonB = jsonBuilder();
jsonB.startObject();
...
jsonB.field("ct", (byte)5);
jsonB.endObject();
...
es.getClient().prepareIndex(INDEX_DOCUMENTS, "document",uid).setSource(jsonB).execute().actionGet();
Reading back:
QueryBuilder b = QueryBuilders.queryString(str).defaultOperator(Operator.OR).allowLeadingWildcard(false).useDisMax(true);
SearchRequestBuilder request = es.getClient().prepareSearch(INDEX_DOCUMENTS)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.addFields("ct")
.setFrom(n).setSize(limit)
.setQuery(b);