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

Support unsigned number types #13951

Closed
bra-fsn opened this issue Oct 5, 2015 · 13 comments
Closed

Support unsigned number types #13951

bra-fsn opened this issue Oct 5, 2015 · 13 comments
Labels
discuss :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch

Comments

@bra-fsn
Copy link

bra-fsn commented Oct 5, 2015

There are a lot of cases, where you want to store a byte/short/int/long in an elastic field, but it's unsigned by nature. With byte/short/int, it's always possible to use a bigger type (at the cost of increased storage space? I haven't measured that), but not with long.
Splitting numbers or subtracting/adding the "magic number" from and to the value is a nightmare.
I think it would be much more convenient to support unsigned types natively.

Theoretically on elasticsearch side it wouldn't be too hard: if a field is marked as unsigned (ubyte/ushort/uint/ulong?), every value which "comes in" needs to be decreased by 2^(bitsize(type)-1), and when "going out", increased by the same amount. Otherwise elasticsearch internals wouldn't change.
Of course representing the unsigned values with Java native signed types can be tricky (BigInteger or Java 8 native unsigned types?).

@rjernst
Copy link
Member

rjernst commented Oct 5, 2015

The values are mostly already compressed in lucene. For example, if your values range from -1 to 253, only a single byte should be used (depends on what features you have enabled for the field eg indexed, stored, doc values).

I don't think we should complicate the api with more types. Other than input validation (which the user can do on their end), the different types for long/int/short/byte don't matter to lucene. They are simply numeric and we will represent them according to the values seen. I would rather see the ability to set the valid range of values in the mapping, and limit to just "integral" and "floating point" field types. (Granted the types do matter for fielddata, but with doc values by default for 2.0 this doesn't really matter anymore).

@jpountz
Copy link
Contributor

jpountz commented Oct 6, 2015

Granted the types do matter for fielddata

Actually they don't, so even on 1.x things are just fine.

@clintongormley clintongormley added :Search Foundations/Mapping Index mappings, including merging and defining field types discuss labels Oct 6, 2015
@clintongormley
Copy link
Contributor

I think the only time that type may be relevant is when you want to use an unsigned long that doesn't fit into the range of a signed long?

@rjernst
Copy link
Member

rjernst commented Oct 6, 2015

Once we get BigDecimal support it becomes irrelevant I think? I would rather wait for that (hopefully not too long now with BKD going into lucene core soon) than add something the the api right now that would require complex internal changes (how do you represent an unsigned long without BigDecimal in java?).

@clintongormley
Copy link
Contributor

++

@bra-fsn
Copy link
Author

bra-fsn commented Oct 6, 2015

@clintongormley: Currently, I have to use cases:

  1. I have several unsigned int fields, which I can't express with signed integer. If I set them to long, the "binding" part of the ES schema (mapping) disappears, the devs think that it's a long and handle it accordingly. Apps break if anybody writes a value which can't be expressed in unsigned int space.
  2. Yes, unsigned long is another (big :) problem. I have to do math or express them as strings, but I lose the arithmetic operators then (search for ranges etc)
    And third (which I couldn't think ES will ever support): arbitrary size numbers. For example I store several 128, 256, 384 and 512 bit hash values.
    Now I can only do this with:
  3. split numbers (into 64 bits and I have to do unsigned-signed-unsigned conversions)
  4. num to string encoding
  5. hex storage as string
  6. binary storage (base64)
    Instead of writing a 512 bit number...

As far as I can remember, 1 and 2 was the most space efficient (storing several billions, so space matters), but having an arbitrary sized integer would be the best.

So my point is:

  1. having different (unsigned/signed) types helps in keeping consistency (value range enforcement) across different users - sometimes there are just too much devs hanging around
  2. having a bigdecimal would also be a big advantage

Thanks,

@bra-fsn
Copy link
Author

bra-fsn commented Oct 6, 2015

@rjernst: "(how do you represent an unsigned long without BigDecimal in java?)"
With BigInteger? :)

@rjernst
Copy link
Member

rjernst commented Oct 6, 2015

  1. having different (unsigned/signed) types helps in keeping consistency (value range enforcement) across different users - sometimes there are just too much devs hanging around

See my comments before. Would the problem you have with storing an unsigned int in a long be handled by allowing you to set the minimum and maximum value allowed on numeric types? This way it could be a long, but you set 0 as the min and max unsigned int as the max. The only limitation (for now, until we have bigint/decimal support) would be you still could not represent anything outside of min/max signed long.

  1. having a bigdecimal would also be a big advantage

See the issue #5683, and the latest lucene issue to support this, https://issues.apache.org/jira/browse/LUCENE-6825

@bra-fsn
Copy link
Author

bra-fsn commented Oct 6, 2015

@rjernst: yes, for me having a min/max (and an arbitrary precision integer :) would be enough, given that it won't explode the storage space needs.

@jpountz
Copy link
Contributor

jpountz commented Oct 16, 2015

We just discussed this issue in FixitFriday: we like specifying types using byte,short,int,long better than min and max values.

And given that doc values compute dynamically how many bits per value are required, space requirements would be pretty similar between an unsigned int field and a long, so implementing support for unsigned numeric types would not help.

@jpountz jpountz closed this as completed Oct 16, 2015
@pjcard
Copy link

pjcard commented Jan 11, 2017

@rjernst Thanks for your suggestion, however it won't help us or anyone else indexing 64-bit hashes, our workaround for those at the moment is to store them as a string.

mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

I chose not to use the Hellogopher Makefile because I felt it was doing
more than is necessary for this repo (e.g. vendoring goimports). The
dependencies for this code are vendored using gvt, the vendoring tool
used by Hellogopher.

I've used semantic versioning rather than our usual versioning schema
because I'd like to open-source this tool soon.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
mattbostock added a commit to cloudflare/alertmanager2es that referenced this issue Apr 13, 2017
Add a new service, `alertmanager2es`, which receives [HTTP webhook
notifications][] from [AlertManager][] and inserts them into an
[Elasticsearch][] index for searching and analysis.

Notifications are received on the `/webhook` endpoint.

Prometheus metrics are exposed on `/metrics`.

Note that this service will not capture silenced or inhibited alerts
currently.

I used a custom type for `groupKey` so that the `groupKey` field can be
marshalled into JSON as a string, since Elasticsearch does not currently
support unsigned integers:

elastic/elasticsearch#13951

I tested extensively to try to map the integer to a string using
Elasticsearch's mappings, which I succeeded in doing, however Kibana
then failed to display the documents because Elasticsearch's
highlighting could not handle the unsigned integer stored in `_source`:

    RemoteTransportException[[Eternal Brain][172.17.0.2:9300][indices:data/read/search[phase/query+fetch]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
    Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [alerts.labels.decoded_pem_md5]]]; nested: IllegalStateException[No matching token for number_type [BIG_INTEGER]];
            at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
            at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:140)
            at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
            at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:490)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:392)
            at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryFetchTransportHandler.messageReceived(SearchServiceTransportAction.java:389)
            at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
            at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:77)
            at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
            at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at java.lang.Thread.run(Thread.java:745)

The dependencies for this code are vendored using gvt.

[AlertManager]: https://github.com/prometheus/alertmanager
[Elasticsearch]: https://www.elastic.co/products/elasticsearch
[HTTP webhook]: https://prometheus.io/docs/alerting/configuration/#webhook-receiver-<webhook_config>
@bluikko
Copy link

bluikko commented Aug 28, 2019

This is a seriously disappointing limitation. 64-bit numbers cannot be stored (since long is signed) -- years after this issue was opened.

@guillaumevauvert-datadome

unsigned_long does exist now :-)

@javanna javanna added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch
Projects
None yet
Development

No branches or pull requests

8 participants