URLs with ?fields parameter: getting error: No matching token for number_type BIG_INTEGER

My project has documents with very large integers. In order to index those
documents, I have to set their types to string (or double) -- either one
works.

However, I get the following exception whenever a URL includes a "?fields="
parameter.

Here's a simple demonstration (also available as a Gist:
https://gist.github.com/hindman/7591513):

Create index.

curl -X DELETE localhost:9200/xx
curl -X PUT localhost:9200/xx

Set up the mapping to handle very large integer fields.

curl -X PUT localhost:9200/xx/yy/_mapping -d '{"yy": {"properties": {"a":
{"type": "string"}, "b": {"type": "string"}}}}'

Index two documents, the second having very large integers.

curl -X PUT localhost:9200/xx/yy/1 -d '{"a": 123, "b": 456}'
curl -X PUT localhost:9200/xx/yy/2 -d '{"a": 933655199414565157, "b":
9917602859033623819}'

Everything is working so far: I can retrieve the documents.

curl -X GET localhost:9200/xx/yy/1
curl -X GET localhost:9200/xx/yy/2

I can use a ?fields= query parameter with the first document.

curl -X GET localhost:9200/xx/yy/1?fields=a,b

But not with the second.

curl -X GET localhost:9200/xx/yy/2?fields=a,b

{"error":"ElasticSearchIllegalStateException[No matching token for
number_type [BIG_INTEGER]]","status":500}

Here's my version info: 0.90.5, Build: c8714e8/2013-09-17T12:50:20Z, JVM:
1.6.0_65.

Am I doing something incorrectly, or is there a workaround? 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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

I played a little with your gist (thanks BTW for providing a full curl recreation. It really helps a lot!)

You defined a mapping with a and b as string.
If you change your PUT requests to this:
curl -X PUT localhost:9200/xx/yy/1 -d '{"a": "123", "b": "456"}'
curl -X PUT localhost:9200/xx/yy/2 -d '{"a": "933655199414565157", "b": "9917602859033623819"}'

Everything works fine.

If you try ton change the mapping and use numbers (long) instead of string, you will get that message when putting the 2nd document :

{"error":"MapperParsingException[failed to parse [b]]; nested: JsonParseException[Numeric value (9917602859033623819) out of range of long (-9223372036854775808 - 9223372036854775807)\n at [Source: [B@18b0a0; line: 1, column: 51]]; ","status":400}

Best

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 22 novembre 2013 at 00:09:44, Monty Hindman (montyhindman@gmail.com) a écrit:

My project has documents with very large integers. In order to index those documents, I have to set their types to string (or double) -- either one works.

However, I get the following exception whenever a URL includes a "?fields=" parameter.

Here's a simple demonstration (also available as a Gist: https://gist.github.com/hindman/7591513):

Create index.

curl -X DELETE localhost:9200/xx
curl -X PUT localhost:9200/xx

Set up the mapping to handle very large integer fields.

curl -X PUT localhost:9200/xx/yy/_mapping -d '{"yy": {"properties": {"a": {"type": "string"}, "b": {"type": "string"}}}}'

Index two documents, the second having very large integers.

curl -X PUT localhost:9200/xx/yy/1 -d '{"a": 123, "b": 456}'
curl -X PUT localhost:9200/xx/yy/2 -d '{"a": 933655199414565157, "b": 9917602859033623819}'

Everything is working so far: I can retrieve the documents.

curl -X GET localhost:9200/xx/yy/1
curl -X GET localhost:9200/xx/yy/2

I can use a ?fields= query parameter with the first document.

curl -X GET localhost:9200/xx/yy/1?fields=a,b

But not with the second.

curl -X GET localhost:9200/xx/yy/2?fields=a,b

{"error":"ElasticSearchIllegalStateException[No matching token for number_type [BIG_INTEGER]]","status":500}

Here's my version info: 0.90.5, Build: c8714e8/2013-09-17T12:50:20Z, JVM: 1.6.0_65.

Am I doing something incorrectly, or is there a workaround? 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.
For more options, visit https://groups.google.com/groups/opt_out.

--
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.
For more options, visit https://groups.google.com/groups/opt_out.