I have created native script that checks if a specific field (mapped to
type long) in the document is empty, using three different options below,
the two first options sometime return false.
Is there a documentation on the semantics of each option?
From what I see, the first two options use
PackedArrayIndexFieldData.loadDirect(AtomicReaderContext context) which
gets the terms from a Lucene reader (lucene.index.SegmentReader) and since
they're not null, the field value isn't considered empty.
I'm using ElasticSearch 0.90.5 and java 1.7u17.
public class MapScript extends AbstractSearchScript { @Override
public Object run() {
if (!doc().containsKey("field2")) //sometime false
return new Object();
if (doc().get("field2") == ScriptDocValues.EMPTY) //sometime false
return new Object();
ScriptDocValues value = (ScriptDocValues) doc().get("field2");
if (value.isEmpty()) //always true
return new Object();
return new Object();
}
I have created native script that checks if a specific field (mapped to
type long) in the document is empty, using three different options below,
the two first options sometime return false.
Is there a documentation on the semantics of each option?
From what I see, the first two options use
PackedArrayIndexFieldData.loadDirect(AtomicReaderContext context) which
gets the terms from a Lucene reader (lucene.index.SegmentReader) and since
they're not null, the field value isn't considered empty.
I'm using Elasticsearch 0.90.5 and java 1.7u17.
public class MapScript extends AbstractSearchScript { @Override
public Object run() {
if (!doc().containsKey("field2")) //sometime false
return new Object();
if (doc().get("field2") == ScriptDocValues.EMPTY) //sometime false
return new Object();
ScriptDocValues value = (ScriptDocValues) doc().get("field2");
if (value.isEmpty()) //always true
return new Object();
return new Object();
}
I have created native script that checks if a specific field (mapped to
type long) in the document is empty, using three different options below,
the two first options sometime return false.
Is there a documentation on the semantics of each option?
From what I see, the first two options use
PackedArrayIndexFieldData.loadDirect(AtomicReaderContext context) which
gets the terms from a Lucene reader (lucene.index.SegmentReader) and since
they're not null, the field value isn't considered empty.
I'm using Elasticsearch 0.90.5 and java 1.7u17.
public class MapScript extends AbstractSearchScript { @Override
public Object run() {
if (!doc().containsKey("field2")) //sometime false
return new Object();
if (doc().get("field2") == ScriptDocValues.EMPTY) //sometime false
return new Object();
ScriptDocValues value = (ScriptDocValues) doc().get("field2");
if (value.isEmpty()) //always true
return new Object();
return new Object();
}
--
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.
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.