# Source() and doc() disparity in a AbstractDoubleSearchScript

**URL:** <https://discuss.elastic.co/t/source-and-doc-disparity-in-a-abstractdoublesearchscript/16921>\
**Category:** Elasticsearch\
**Created:** [April 10, 2014, 1:04pm UTC](https://discuss.elastic.co/t/source-and-doc-disparity-in-a-abstractdoublesearchscript/16921 "2014-04-10T13:04:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddie](https://avatars.discourse-cdn.com/v4/letter/e/f07891/32.png) [@eddie](https://discuss.elastic.co/u/eddie)\
**Post date:** [April 10, 2014, 1:04pm UTC](https://discuss.elastic.co/t/source-and-doc-disparity-in-a-abstractdoublesearchscript/16921/1 "2014-04-10T13:04:16Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/30805e73-97aa-4f09-a686-4067917138c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:36am UTC](https://discuss.elastic.co/t/source-and-doc-disparity-in-a-abstractdoublesearchscript/16921/2 "2017-07-06T01:36:55Z")

</div>

Closed on July 6, 2017, 1:36am UTC


