-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[BUG] Calling getMillis() in Painless script is slow #3156
Comments
Would love a PR, @mbaranczak, thank you! |
@mbaranczak interesting, here is the
@dblock this method is deprecated and should not be used in general, should such deprecated methods in 2.0? |
Is it really necessary to deprecate/remove this method? If And here's another thing: since I'm using OpenSearch in a managed environment, I don't have access to the server log (or wherever this deprecation warning gets written to). So I don't even see the warning. In my use case, |
@mbaranczak the deprecation story goes back to Elasticsearch, this is what Opensearch inherited.
I believe you should get them inside |
@reta I'm not seeing any warnings in the headers, either. Are the warning headers always on, or is there some switch to turn them on and off? |
@mbaranczak sorry, my bad, it is OFF by default but could be configured by adding
to
|
I don't know why it was deprecated in Elasticsearch. I suppose nobody wants to keep methods that don't actually do anything other than call other methods that do the same thing around. Major versions have other breaking changes, and I think the right thing to do here would be to remove the deprecated method from 3.0 (main). This way it will break hard in a major upgrade instead of causing a silent performance regression. Want to PR it if you agree? |
@dblock 👍 to that, will create an issue + change |
@reta I'm not running my own server, I'm using the Amazon OpenSearch Service. No, I don't see any way to change the log4j properties. |
Got it, I am not sure there are any other way to get these deprecation warning without accessing logs or changing configuration. You could probably open a case with AWS regarding that, those are vendor-specific constraints apparently. |
Describe the bug
We had a sorting script that called
getMillis()
on a date field. We noticed that the script was unusually slow for queries that matched a large number of results, and determined thatgetMillis()
was the bottleneck. Removing that call resulted in a 10-fold speed-up.I found this bug report for ElasticSearch 6.5.0, which looks very similar to what I ran into. It says that the bug was fixed; maybe the fix never made it into OpenSearch, maybe the bug came back. elastic/elasticsearch#35754
I had good results with the work-around suggested in that report (replacing
getMillis()
withtoInstant().toEpochMilli()
).To Reproduce
On an index with a datetime field called
originalDate
, and a large number of documents (a million or more), run this search:Host/Environment:
Amazon OpenSearch service v1.0
The text was updated successfully, but these errors were encountered: