elasticsearch-river-mongodb icon indicating copy to clipboard operation
elasticsearch-river-mongodb copied to clipboard

index script fields

Open gairom opened this issue 10 years ago • 3 comments

Hi, I'm trying to change few fields strings using js, for example take only the last part of the URL taken from mongo through the river so in elasticsearch I'll have only the end of it. When creating the index (using curl) I added under "options" the following script: "script": "ctx.document.url = ctx.document.url.substr(-4);" I tried some manipulations such as adding "..." and others but nothing seems to work, I always get the full url. Can anyone suggest what is the right syntax to make it work?

Another thing I need to do is combine to fields - lat & long, to one "location" field in order to use it in Kibana, can anyone suggest the right script for that? (create new field called "location" which contain both field "lat" & "long" with comma between them). Thanks.

gairom avatar Feb 12 '15 23:02 gairom

Update: also tried to use ctx._source.url but didn't work as well.

gairom avatar Feb 12 '15 23:02 gairom

@gairom some news about this issue?

maintux avatar Mar 25 '15 17:03 maintux

@gairom just solved. read this http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html

maintux avatar Mar 25 '15 17:03 maintux