I'm having trouble with the FOSElastica bundle config. I use the JMS Serializer, and I try to add objects which have fields which contains literally a json array. But, when I try to populate some of them, it gives me these errors :
Error in one or more bulk request actions:
index: /table_content/table_content/10 caused mapper [corrected_value_float.args.argument1] cannot be changed from type [long] to [float]
index: /table_content/table_content/11 caused mapper [difference_value_float.entry] cannot be changed from type [float] to [long]
Currently, I'm having trouble understanding how he deduces what type of argument is in the json array. To be clear, I think JMS just serialize the object like any other and associate {"field" : "value"} as json, and here the "value" in the database is an actual json array, so elastica index it and kind of "guess" a type for the values of the array.
Problematic json array for /table_content/table_content/10 (my guess is he doesn't like the 100 at the end of "argument1") :
{
"args": {
"argument1":[0.0002777777777777778,1.123888888888889,2.2475,3.371111111111111,4.494722222222222,5.618333333333334,6.741944444444444,7.865555555555555,8.988888888888889,10.112499999999999,11.23611111111111,12.359722222222222,13.483333333333333,14.606944444444444,15.730555555555556,16.854166666666668,17.977777777777778,19.10138888888889,20.224999999999998,21.34861111111111,22.47222222222222,23.59583333333333,24.71944444444444,25.842777777777776,26.96638888888889,28.09,29.21361111111111,30.33722222222222,31.460833333333333,32.58444444444444,33.70805555555556,34.83166666666667,35.95527777777778,37.07888888888889,38.2025,39.32611111111112,40.44972222222222,41.57333333333334,42.696666666666665,43.82027777777778,44.943888888888885,46.0675,47.191111111111105,48.31472222222222,49.43833333333333,50.56194444444444,51.68555555555555,52.80916666666666,53.93277777777777,55.05638888888888,56.18,57.30361111111111,58.426944444444445,59.550555555555555,60.674166666666665,61.797777777777775,62.921388888888885,64.045,65.16861111111112,66.29222222222222,67.41583333333334,68.53944444444444,69.66305555555556,70.78666666666666,71.91027777777778,73.03388888888888,74.1575,75.28083333333333,76.40444444444445,77.52805555555555,78.65166666666667,79.77527777777777,80.89888888888889,82.0225,83.14611111111111,84.26972222222223,85.39333333333335,86.51694444444445,87.64055555555557,88.76416666666667,89.88777777777779,91.01138888888889,92.13472222222222,93.25833333333334,94.38194444444444,95.50555555555556,96.62916666666666,97.75277777777778,98.87638888888888,100]
}
}
Problematic json array for /table_content/table_content/11 :
{"args": {
"entry":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
}
}
For the second problematic array, I don't even understand why he considers one of the numbers a float, when it's only made of 0.
How would I be able to tell him what type to give to the json array values, even though I use a serializer for the rest of the objects ? Where in elastica bundle does it "guess" what type is in these arrays ?
_mapping
of your index. You can specify a mapping on your own in order to avoid this. – Baro