Skip to content

_value support in painess?#18284

Merged
rmuir merged 2 commits intoelastic:masterfrom
rmuir:painless_value_aggregations
May 12, 2016
Merged

_value support in painess?#18284
rmuir merged 2 commits intoelastic:masterfrom
rmuir:painless_value_aggregations

Conversation

@rmuir
Copy link
Copy Markdown
Contributor

@rmuir rmuir commented May 11, 2016

this makes aggregations per-document _value fast (bypass hash put, hash get, etc) for painless.

but i have no clue how to test it, it seems this feature never worked via REST? If i try to pass script at all, terms aggregation says GFY.

Should we drop the feature instead? Did it ever work????

@clintongormley @s1monw

Some guidance please, I'm kinda frustrated. I just want to make this stuff fast.

…sh get, etc) for painless.

but i have no clue how to test it, it seems this feature never worked via REST?

Should we drop the feature instead?
@rmuir rmuir added the PITA label May 11, 2016
@rmuir
Copy link
Copy Markdown
Contributor Author

rmuir commented May 11, 2016

@rmuir
Copy link
Copy Markdown
Contributor Author

rmuir commented May 11, 2016

Seems a lot of the docs were out of date here. I have concerns this feature is actually used...

@s1monw
Copy link
Copy Markdown
Contributor

s1monw commented May 11, 2016

@rmuir and I spoke offline and the examples seem to be outdated in current master but work in 2.x so at least that is resolved. The question why we have this special value is still open and if we can / should move away from it?

@rmuir
Copy link
Copy Markdown
Contributor Author

rmuir commented May 11, 2016

Right thats the thing, we should optimize for common cases. This PR optimizes this _value so that its not going to do a bunch of per-document hash gets and puts, etc. Lucene expressions also already optimizes for it.

It was my understanding that this is how scripts interact with aggregations. So if this is true, then I want things to be performant, and i want the syntax to be easy.

@jdconrad
Copy link
Copy Markdown
Contributor

LGTM on the Painless portion.

@jdconrad jdconrad added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v5.0.0-alpha3 labels May 11, 2016
@rjernst
Copy link
Copy Markdown
Member

rjernst commented May 12, 2016

LGTM too

@jdconrad
Copy link
Copy Markdown
Contributor

LGTM. Let's move forward.

@rmuir rmuir merged commit 3b66d40 into elastic:master May 12, 2016
@jdconrad jdconrad mentioned this pull request May 12, 2016
18 tasks
@clintongormley
Copy link
Copy Markdown
Contributor

@rmuir this feature works in 5.0.0-alpha2 and in master:

PUT t/t/1
{
  "foo": [5,10]
}

GET t/_search?size=0
{
  "aggs": {
    "foo": {
      "terms": {
        "field": "foo",
        "script": {
          "inline": "_value",
          "lang": "groovy"
        }
      }
    }
  }
}

There are two forms of scripts here: One where you don't specify the field, which is called once per doc, and one where you DO specify the field, which is called once per field _value.

@rmuir
Copy link
Copy Markdown
Contributor Author

rmuir commented May 12, 2016

@rmuir this feature works in 5.0.0-alpha2 and in master:

The confusion here was caused by the 5.0 docs not having script/inline but having what @s1monw called "1.x style scripting". So when i chased down this _value to see what it was all about: none of the examples worked. And there was not a lone rest test in the system using the feature (second problem)!

I think we can fix the docs side, I would like to convert them all to painless anyway and also make them use the special notation so they are tested.

@clintongormley
Copy link
Copy Markdown
Contributor

ah ok - thanks for the explanation

@clintongormley clintongormley added :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache and removed :Plugin Lang Painless labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Scripting Scripting abstractions, Painless, and Mustache >enhancement PITA v5.0.0-alpha3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants