Skip to content
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

Script: ulong via fields API (#76519) #76613

Merged
merged 1 commit into from
Aug 17, 2021

Commits on Aug 17, 2021

  1. Script: ulong via fields API (elastic#76519)

    Exposes unsigned long via the fields API.
    
    Unsigned longs default to java signed longs.  That means the upper range
    appears negative.  Consumers should use `Long.compareUnsigned(long, long)`
    `Long.divideUnsigned(long, long)` and `Long.remainderUnsigned(long, long)`
    to correctly work with values known to be unsigned long.
    
    Alternatively, users may treat the unsigned long type as `BigInteger` using
    the field API, `field('ul').as(Field.BigInteger).getValue(BigInteger.ZERO)`.
    ```
    field('ul').as(Field.BigInteger).getValue(BigInteger.valueOf(1000))
    field('ul').getValue(1000L)
    ```
    
    This change also implements the beginning of the converters for the fields
    API.  The following conversions have been added:
    ```
    ulong <-> BigInteger
    long <-> BigInteger
    double -> BigInteger
    String (parsed as long or double) -> BigInteger
    double -> long
    String (parsed as long or double) -> long
    Date (epoch milliseconds) -> long
    Nano Date (epoch nanoseconds) -> long
    boolean (1L for true, 0L for false) -> long
    ```
    
    Backport: aea8bff
    stu-elastic committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    f64d370 View commit details
    Browse the repository at this point in the history