Skip to content

Conversation

@stu-elastic
Copy link
Contributor

@stu-elastic stu-elastic commented Dec 7, 2021

Adds scripting fields API support the rest of the long fields:

  • _version - VersionDocValuesField
  • _seq_no - SeqNoDocValuesField
  • murmur3 - Murmur3DocValueField
    • Added Painless support to the murmur3 mapper plugin.

All SortedNumericDocValues that are interpreted as longs are now subclasses of AbstractLongDocValuesField, including murmur, doc version and seq no above as well as LongDocValuesField and UnsignedLongDocValuesField

Also adds:

  • x-pack's version - VersionStringDocValuesField
    • Created new Version value type as a location for future helpers for comparing versions.
      • Implements toString for the expected representation of the version
    • Implements asString(String) and asString(int, String), asStrings() converters on field.

Refs: #79105

@stu-elastic stu-elastic added >enhancement :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache labels Dec 7, 2021
@elasticsearchmachine
Copy link
Collaborator

Hi @stu-elastic, I've created a changelog YAML for you.

@stu-elastic
Copy link
Contributor Author

@elasticsearchmachine run elasticsearch-ci/part-2

@stu-elastic stu-elastic marked this pull request as ready for review January 5, 2022 20:12
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Jan 5, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Left a few minor comments.

@Override
public Map<ScriptContext<?>, List<Whitelist>> getContextWhitelists() {
List<Whitelist> whitelist = singletonList(WHITELIST);
return Map.of(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know what the behavior of murmur3 is in contexts where it was previously available as a long, but not available as one of the contexts here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added all core contexts and added #82289

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
return builder.value(this.toString());
return builder.value(toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this changed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted.


/**
* Script value class.
* TODO(stu): implement {@code Comparable<Version>} based on {@code VersionEncoder#prefixDigitGroupsWithLength(String, BytesRefBuilder)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address this TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added link to #82287 in TODO

@stu-elastic stu-elastic merged commit c937a09 into elastic:master Jan 5, 2022
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
…lastic#81476)

Adds scripting fields API support the rest of the long fields:
* [`_version`](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning) - `VersionDocValuesField`
* [`_seq_no`](https://www.elastic.co/guide/en/elasticsearch/reference/master/optimistic-concurrency-control.html) - `SeqNoDocValuesField`
* [`murmur3`](https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-murmur3-usage.html) - `Murmur3DocValueField`
  * Added Painless support to the murmur3 mapper plugin.

All `SortedNumericDocValues` that are interpreted as longs are now subclasses of `AbstractLongDocValuesField`, including murmur, doc version and seq no above as well as `LongDocValuesField` and `UnsignedLongDocValuesField`

Also adds:
* [x-pack's version](https://www.elastic.co/guide/en/elasticsearch/reference/master/version.html) - `VersionStringDocValuesField`
  * Created new `Version` value type as a location for future helpers for comparing versions. 
    * Implements `toString` for the expected representation of the version
  * Implements `asString(String)` and `asString(int, String)`, `asStrings()` converters on field.


Refs: elastic#79105
astefan pushed a commit to astefan/elasticsearch that referenced this pull request Jan 7, 2022
…lastic#81476)

Adds scripting fields API support the rest of the long fields:
* [`_version`](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#index-versioning) - `VersionDocValuesField`
* [`_seq_no`](https://www.elastic.co/guide/en/elasticsearch/reference/master/optimistic-concurrency-control.html) - `SeqNoDocValuesField`
* [`murmur3`](https://www.elastic.co/guide/en/elasticsearch/plugins/current/mapper-murmur3-usage.html) - `Murmur3DocValueField`
  * Added Painless support to the murmur3 mapper plugin.

All `SortedNumericDocValues` that are interpreted as longs are now subclasses of `AbstractLongDocValuesField`, including murmur, doc version and seq no above as well as `LongDocValuesField` and `UnsignedLongDocValuesField`

Also adds:
* [x-pack's version](https://www.elastic.co/guide/en/elasticsearch/reference/master/version.html) - `VersionStringDocValuesField`
  * Created new `Version` value type as a location for future helpers for comparing versions. 
    * Implements `toString` for the expected representation of the version
  * Implements `asString(String)` and `asString(int, String)`, `asStrings()` converters on field.


Refs: elastic#79105
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 Team:Core/Infra Meta label for core/infra team v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants