In my project, I need to deduce the data type of some JSON tree liefs
based on their value and I want to use the same API/mechanism that
elasticsearch uses to do this.
At some point, when indexing documents, elasticsearch will need to do
this job, and I would like to use the same API/mechanism that
elasticsearch uses to avoid different type deduction.
In my project, I need to deduce the data type of some JSON tree liefs
based on their value and I want to use the same API/mechanism that
elasticsearch uses to do this.
At some point, when indexing documents, elasticsearch will need to do
this job, and I would like to use the same API/mechanism that
elasticsearch uses to avoid different type deduction.
Although the logic is naive, is it available in some kind of API that can be used ?
I cannot take the chance of getting the wrong type deduction (or different from the one that elastic will do) and that's why I need to use the exact same code that elastic uses to do his own deduction.
Although the logic is naive, is it available in some kind of API that can
be
used ?
I cannot take the chance of getting the wrong type deduction (or different
from the one that elastic will do) and that's why I need to use the exact
same code that elastic uses to do his own deduction.
Another less complicated way to ensure types is to specify the mapping
explicitly before indexing. This way you never end up with a wrongly
interpreted type by ES, and you know what to expect on the client
side.
Jérémie
On Fri, Nov 25, 2011 at 8:48 AM, Shay Banon kimchy@gmail.com wrote:
Although the logic is naive, is it available in some kind of API that can
be
used ?
I cannot take the chance of getting the wrong type deduction (or different
from the one that elastic will do) and that's why I need to use the exact
same code that elastic uses to do his own deduction.
Jérémie, my data set is huge and I don't know it exactly it's fields,
so I don't know which fields to map... and even if I knew, it wouldn't
be easier! Thanks for your reply anyway.
Shay, thanks for tour reply.
My solution was achieved using JsonPrimitive type comparions
(isBoolean, isString and isNumber), which in the end, does the same
that your field API: compares a field class against the native Java
types. I belive my problem is solved now.
Another less complicated way to ensure types is to specify the mapping
explicitly before indexing. This way you never end up with a wrongly
interpreted type by ES, and you know what to expect on the client
side.
Jérémie
On Fri, Nov 25, 2011 at 8:48 AM, Shay Banon kim...@gmail.com wrote:
Although the logic is naive, is it available in some kind of API that can
be
used ?
I cannot take the chance of getting the wrong type deduction (or different
from the one that elastic will do) and that's why I need to use the exact
same code that elastic uses to do his own deduction.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.