Sorry for popping this up this, but i'm afraid that my last question was
lost in a huge description
Here it is:
Is it possible to make the list of document's sub-objects stored together
with index (or load in memory) to use in inside native filter without
loading and parsing of entire source object.
Here is how it looks now in native script Java code:
@Object public Object run()
final List vars = (List) source().get("variants");
for(Map var: vars) {
// Navigate through and process filters one by one
}
The problem here is source().get("variants"); call - it's very slow
because the "source" itself is about 100Kb.
Any suggestions how to put "variants" into doc() or memory?
On Monday, June 4, 2012 10:20:33 AM UTC+2, Vadim Voituk wrote:
On Wednesday, May 30, 2012 10:51:48 AM UTC+2, kimchy wrote:
When you call doc(), it will go to the field cache, it means that the
indexed terms for the field are loaded into memory and provided. When you
use source(), it will load the source and parse it, when you use fields(),
it will load a stored field . Loading from the index (either specifically
stored fields or source) is slow, its recommended you use the doc part.
Thanks, Shanon, much more clear for me.
To be precise, the "variants" it's not an object, but the list/array of
objects.
Something like:
{
//... other fields ...
"variants": [
{
title: "Variant #1",
filter1: "... some value of filter #1",
filter2: "... some value of filter #2",
filter3: "... some value of filter #3",
},
{
title: "Variant #2",
filter1: "... another value of filter #1",
filter2: "... another value of filter #2",
filter3: "... another value of filter #3",
},
// more variants there...
],
//... other fields ...
}
And as i got from my ES-core investigations, if i'll do the "request" like
doc().fields("variants.filter1")
i'll get the list of all unique values of "filter1" field within
"variants" array.
So the question is - is it possible to make this list of objects to be
accessible without loading and parsing of entire document source?
Looking forward for any feedback or thoughts about this.
Thanks.