Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving byte type stored field fails #1702

Closed
marchh opened this issue Feb 15, 2012 · 0 comments
Closed

Retrieving byte type stored field fails #1702

marchh opened this issue Feb 15, 2012 · 0 comments

Comments

@marchh
Copy link

marchh commented Feb 15, 2012

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);

@kimchy kimchy closed this as completed in e1cca90 Feb 15, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants