# Binary “fields” – index, lookup, etc

**URL:** <https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370>\
**Category:** Dgraph\
**Created:** [April 22, 2019, 4:32pm UTC](https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370 "2019-04-22T16:32:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sirkon](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/sirkon/32/1571_2.png) [@sirkon](https://discuss.dgraph.io/u/sirkon)\
**Post date:** [April 22, 2019, 4:32pm UTC](https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370/1 "2019-04-22T16:32:24Z")

</div>

Hi!

We have `ID` field in our data which is a concatenation of two uuids – it is cheaper to store than a respective concatenation of two uuid strings: 32 vs 74 bytes.

Am I understand it right there is no index type for such kind of data? And is there any way to request for exact binary ID of such kind?

---

<div class="post-metadata">

**Author:** ![dmai](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/dmai/32/1254_2.png) [@dmai](https://discuss.dgraph.io/u/dmai)\
**Post date:** [April 22, 2019, 5:55pm UTC](https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370/2 "2019-04-22T17:55:14Z")

</div>

All scalar types can have indices. Dgraph supports exact and hash indices for strings. There’s also int indices for integer values. [https://docs.dgraph.io/query-language/#indexing](https://docs.dgraph.io/query-language/#indexing)

---

<div class="post-metadata">

**Author:** ![sirkon](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/sirkon/32/1571_2.png) [@sirkon](https://discuss.dgraph.io/u/sirkon)\
**Post date:** [April 22, 2019, 11:00pm UTC](https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370/3 "2019-04-22T23:00:58Z")

</div>

So, no way to lookup and index. This is a shame I must say: as I said we only need to store 32 bytes in binary format vs 74 bytes in case of uuid strings.

---

<div class="post-metadata">

**Author:** ![martinmr](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/martinmr/32/1408_2.png) [@martinmr](https://discuss.dgraph.io/u/martinmr)\
**Post date:** [April 22, 2019, 11:19pm UTC](https://discuss.dgraph.io/t/binary-fields-index-lookup-etc/4370/4 "2019-04-22T23:19:22Z")

</div>

There’s a binary type in Dgraph (there’s missing documentation for this but there’s a PR to add it). There’s also custom tokenizers. So I think you could store your data in a binary format and write a custom tokenizer to output the two separate IDs.

Link to PR: [docs: Add Binary Type by MichelDiz · Pull Request #3307 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/pull/3307)  
Custom tokenizers: [https://docs.dgraph.io/query-language/#indexing-with-custom-tokenizers](https://docs.dgraph.io/query-language/#indexing-with-custom-tokenizers)
