Thanks for the tips.

In case anyone else is looking for a similar solution, my problem had to do 
with types.  The mapping that ended up working is:

{
    "test" : {
"transform" : {
            "script" : "ctx._source['date_created'] = 
ctx._source['date_created'].toLong() * 1000",
            "lang": "groovy"
        },
        "properties" : {
            "date_created" : {"type" : "date"},
        }
    }
}

Note the "toLong()".

Also, once a script is modified, it appears as though the type has to be 
deleted and the mapping re-applied for the changes to take effect.

  Nick

On Monday, December 22, 2014 10:35:08 AM UTC-7, Nick Wood wrote:
>
> Hello,
>
> I'm trying to implement a transform script when my data is being indexed, 
> but it doesn't seem to have any affect.  I basically want to multiply a 
> date_created field by 1000.
>
> I've tried adding this to my mapping
>
> --------------------
>         "transform" : {
>             "script" : "ctx._source['date_created'] = 
> ctx._source['date_created'] * 1000;",
>             "lang": "groovy"
>         },
>         "properties" : { ...
> --------------------
>
> When I index documents, I don't get any errors, but I also can't tell that 
> the script actually ran or changed the data.  How would I troubleshoot 
> whether this script is even firing, and if so, why it's not updating the 
> data?
>
> Best,
>
>   Nick
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/7b4d0870-aba4-4405-8100-5ec127de72f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to