NumberFormatException issues caused by an empty string


(K.B.) #1

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(Karussell) #2

When you define a null_value is there still this exception?

Peter.

On Nov 10, 12:13 pm, "K.B." korbinian.ba...@googlemail.com wrote:

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(K.B.) #3

Hello Peter,

sorry, but I can't follow you. What do you mean?

On 10 Nov., 14:29, Karussell tableyourt...@googlemail.com wrote:

When you define a null_value is there still this exception?

Peter.

On Nov 10, 12:13 pm, "K.B." korbinian.ba...@googlemail.com wrote:

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(K.B.) #4

Ok, tested it:

if I do:

"null_value" : ""

then it gets this error:

org.elasticsearch.index.mapper.MapperParsingException: mapping
[app_shop_produkt]
at org.elasticsearch.cluster.metadata.MetaDataCreateIndexService
$1.execute(MetaDataCreateIndexService.java:242)
at org.elasticsearch.cluster.service.InternalClusterService
$2.run(InternalClusterService.java:205)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NumberFormatException: For input string: ""
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:
48)

So, ES complains about the wrong mapping.

On 10 Nov., 18:15, "K.B." korbinian.ba...@googlemail.com wrote:

Hello Peter,

sorry, but I can't follow you. What do you mean?

On 10 Nov., 14:29, Karussell tableyourt...@googlemail.com wrote:

When you define a null_value is there still this exception?

Peter.

On Nov 10, 12:13 pm, "K.B." korbinian.ba...@googlemail.com wrote:

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(Shay Banon) #5

We can support empty strings as null values for numeric types. Open an
issue. Btw, why not fix the transformation?

On Thu, Nov 10, 2011 at 1:13 PM, K.B. korbinian.bachl@googlemail.comwrote:

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(K.B.) #6

Btw, why not fix the transformation?

Hi Shay, thanks for the hint. I'm doing this already, but this means
another iteration through the data costing CPU + time;
Currently we grab an SQL result from MYSQL that already is in a map
form and pass it to ES via Java API. Problem here is that mysql can't
easily understand that some of the extracted XML values are not String
and instead makes them all to String. This then leads to trouble for
sorting order... so we define for ES some fields as numeric, but then
are buggered with this empty "" and null problem;

Best

On 13 Nov., 08:14, Shay Banon kim...@gmail.com wrote:

We can support empty strings as null values for numeric types. Open an
issue. Btw, why not fix the transformation?

On Thu, Nov 10, 2011 at 1:13 PM, K.B. korbinian.ba...@googlemail.comwrote:

Hello,

I know we had this in the past, but could please a feature be
introduced to have a flag at numbers like integer, float, etc, so we
can have ES make empty Strings a "null" value instead?
Currently an empty String "" ceates a
org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[field] exception;

I have this problem when data extracted from XML is passed to ES (done
by ExtractValue in mysql - he can't differ if null or emptyString
there);

Best


(system) #7