Source() and doc() disparity in a AbstractDoubleSearchScript


(eddie) #1

Hi all,

We have having some issues with differences between source() and doc() in a
search script. We're running 0.90.2 with the following mapping

mappings: {

  • features: {
    • properties: {
    • id: {
      • type: integer
        }
    • histogram: {
      • type: integer
        }
        }
        }

}

Where histogram is an array. Assume the index contains the following three
histograms:

[1,2,3,4,5]
[1,1,2,2,2]
[3,3,3,3,3]

In the search script, when we attempt to retrieve these histograms, I
noticed the following disparity between doc() and source()

doc source

[1,2,3,4,5] [1,2,3,4,5]
[1,2] [1,1,2,2,2]
[3] [3,3,3,3,3]

So in the doc it seems like we are getting the set of the array rather than
the array. I'm retrieving histogram in the following manner:

source: List histogram = (List) source().get("histogram");

doc: List histogram = (List) ((ScriptDocValues)
doc().get("histogram")).getValues();
It would be much appreciated if anyone can help explain why this is
happening

regards

  • eddie

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/30805e73-97aa-4f09-a686-4067917138c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2