On Thu, Sep 05, 2013 at 08:08:30AM +0000, Adrian wrote:
All,
I wonder if it is possible to use scripts within an index statement?
In my scripts, I'd like to perform comparison on fields which are mapped as
"date". Given the documentation, these types are json strings, but handled as
Java long types internally. Using MVEL as scripting, I've found operators for
value comparison. Can someone tell on which types (String vs. long) this
comparison is performed?
Hi,
I don't think you can use scripting while indexing. Scripting is more meant
to on-the-fly generate content that you don't have when retrieving docs,
for instance when searching, faceting etc.
Regarding the type question, it depends on where you load the value from.
Have a look here: Elasticsearch Platform — Find real-time answers at scale | Elastic. If you
load it from disk, using the _source syntax, then it's going to be a
string, like in the json. If you load it from the document fields (field
data), it's going to be a long.
Cheers
Luca
On Thursday, September 5, 2013 11:55:41 AM UTC+2, Adrian wrote:
On Thu, Sep 05, 2013 at 08:08:30AM +0000, Adrian wrote:
All,
I wonder if it is possible to use scripts within an index statement?
In my scripts, I'd like to perform comparison on fields which are mapped
as
"date". Given the documentation, these types are json strings, but handled
as
Java long types internally. Using MVEL as scripting, I've found operators
for
value comparison. Can someone tell on which types (String vs. long) this
comparison is performed?
On Thu, Sep 05, 2013 at 08:09:53AM -0700, Luca Cavanna wrote:
Luca,
Regarding the type question, it depends on where you load the value from.
Have a look here: Elasticsearch Platform — Find real-time answers at scale | Elastic. If you
load it from disk, using the _source syntax, then it's going to be a
string, like in the json. If you load it from the document fields (field
data), it's going to be a long.
So, referencing the date field in an update (using ctx._source.) the
comparison operators "<,>" should suffice.
Scripting is meant to be used during querying time. What are you looking to
achieve? If you are looking at changing the content that is indexed, you
can perhaps use a custom filter/tokenizer/analyzer or modify the data at
the client (index) side.
On Thu, Sep 05, 2013 at 11:00:33AM -0700, Ivan Brusic wrote:
Ivan,
Scripting is meant to be used during querying time. What are you looking to
achieve? If you are looking at changing the content that is indexed, you
can perhaps use a custom filter/tokenizer/analyzer or modify the data at
the client (index) side.
I have a quite huge number of documents (> 2 Bio.). When doing an overview of
these using facets on a certain field, the querying time is just too long. So I
tried to build a second index, holding this (aggregated) data. The scripting
was intented to update th relvant fields for this index (such as first seen,
last seen, etc.)
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.