-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index fails if field used for _parent in the script is ObjectId #85
Comments
Can you please provide an example? Thanks, |
Hi Richard, We can recreate the issue using the files you have for #64 ( https://github.com/richardwilly98/elasticsearch-river-mongodb/tree/master/resources/issues/64 ), by replacing the content of " _03-import-document.js" to below.
Thanks |
Hi Richard, A question unrelated to this issue. Any thoughts on how to change the format of the date fields before pushing to elasticsearch. I want to change the date to milliseconds format. I tried the below script in my river definition, but it failed with the error "Rhino runtime detected object Sat Jun 15 19:12:20 EDT 2013 of class java.util.Date where it expected String, Number, Boolean or Scriptable instance." I thought RHINO will process that as the native Javascript Date object but it treats it as java Date.
Also for testing sake I hardcoded the numeric date value as below
and it results in number getting changed to decimal format like below
Instead of
Any thoughts for both the above issues - 1) Convert the ISO Date to millisecond format and 2 ) Not have he millisecond number into decimal format. Google and Elastic search forums have not been of much help on this. Appreciate your help. Thanks |
All extract methods will call toString method if the object is not null.
Thanks I thought about creating a separate issue but I asked here as it was more related to scripting than an issue with this plugin. Also I have tested this _parent fix and it works. Thanks much |
Fixed in release 1.6.9 |
Hi Richard, Even though this issue is fixed, I notice that the warning is still occurring in the logs, yesterday when I tested I think I missed to see the warning message, I tested again with the 1.6.9 version and see the below message. The document is correctly indexed though RHINO USAGE WARNING: Missed Context.javaToJS() conversion: Thanks |
Hi Zafer, Unfortunately this warning seems to be specific to elasticsearch/elasticsearch-lang-javascript plugin. A DBObject object is passed to Rhino it should be wrapped by the plugin using as suggested Context.javaToJS. So I will not be able to fix it from the river. I believe using Groovy script if your javascript becomes complex might be a good option. Thanks, |
It is wierd that a DBObject is being passed even after converting to String. But thanks for looking, I can live with the warning for now and if it gets worse then I'll look into Context.javaToJS or Groovy script. Thanks |
Getting the below error if the _parent field used in river script is an objectid.
RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object 517749830364f0329c6c386f of class org.bson.types.ObjectId where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.
[2013-06-05 23:03:49,885][WARN ][org.elasticsearch.river.mongodb.MongoDBRiver$Indexer] failed to execute bulk
org.elasticsearch.action.RoutingMissingException: routing is required for [authors]/[book]/[51774a210364f0329c6c387a]
In the extractParent (https://github.com/richardwilly98/elasticsearch-river-mongodb/blob/master/src/main/java/org/elasticsearch/river/mongodb/MongoDBRiver.java#L830 ) we'll have to check if the field is objectId, if so then it needs to be converted to string.
The text was updated successfully, but these errors were encountered: