# Cannot create @id field with exact index

**URL:** <https://discuss.dgraph.io/t/cannot-create-id-field-with-exact-index/13080>\
**Category:** GraphQL\
**Tags:** status:accepted, kind:bug, ticket:created\
**Created:** [March 5, 2021, 8:43pm UTC](https://discuss.dgraph.io/t/cannot-create-id-field-with-exact-index/13080 "2021-03-05T20:43:18Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [March 5, 2021, 8:43pm UTC](https://discuss.dgraph.io/t/cannot-create-id-field-with-exact-index/13080/1 "2021-03-05T20:43:18Z")

</div>

* * *

## Report a GraphQL Bug

### What edition and version of Dgraph are you using?

Edition:

- SlashGraphQL
- Dgraph (community edition/Dgraph Cloud)

If you are using the community edition or enterprise edition of Dgraph, please list the version:

> **Dgraph Version**
>
> Dgraph master and Dgraph v20.11.2 (latest)
> 
> master
> 
> ```nohighlight
> $ dgraph version
> 
> Dgraph version : v20.11.0-rc1-414-gf21ee367
> Dgraph codename : unnamed
> Dgraph SHA-256 : f47c24e6bb5c05a7491f125b7d8f4b77b6337ed69acfc150c3c7189f30810db3
> Commit SHA-1 : f21ee367
> Commit timestamp : 2021-03-02 13:18:11 -0800
> Branch : master
> Go version : go1.15.5
> jemalloc enabled : true
> 
> ```
> 
> v20.11.2
> 
> ```nohighlight
> Dgraph version : v20.11.2
> Dgraph codename : tchalla-2
> Dgraph SHA-256 : 0153cb8d3941ad5ad107e395b347e8d930a0b4ead6f4524521f7a525a9699167
> Commit SHA-1 : 94f3a0430
> Commit timestamp : 2021-02-23 13:07:17 +0530
> Branch : HEAD
> Go version : go1.15.5
> jemalloc enabled : true
> 
> ```

### Have you tried reproducing the issue with the latest release?

Yes

### Steps to reproduce the issue (paste the query/schema if possible)

Apply this GraphQL schema:

```auto
type Post {
    name: String! @id @search(by: [exact])
}

```

### Expected behaviour and actual result.

Actual result: The schema update gives this error message:

`resolving updateGQLSchema failed because input:2: Type Post; Field name: the arguments 'hash' and 'exact' can't be used together as arguments to @search.\n`

Exact index is compatible with the `@id` functionality to maintain the uniqueness of the name field. So, I should be able to create an `@id` field and take advantage of the `exact` search functionality as well.

---

<div class="post-metadata">

**Author:** ![JatinDevDG](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/jatindevdg/32/3417_2.png) [@JatinDevDG](https://discuss.dgraph.io/u/JatinDevDG)\
**Post date:** [March 6, 2021, 11:30am UTC](https://discuss.dgraph.io/t/cannot-create-id-field-with-exact-index/13080/3 "2021-03-06T11:30:00Z")

</div>

Hi @dmai , Thanks for creating this bug. We add `hash` index for predicate which have @id directive while converting schema to dgraph. That’s why , we are not able to add exact index on it.  
I need to discuss it with team members whether it was design decision or it’s a bug, and if it’s a bug , will fix it soon.

---

<div class="post-metadata">

**Author:** ![JatinDevDG](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/jatindevdg/32/3417_2.png) [@JatinDevDG](https://discuss.dgraph.io/u/JatinDevDG)\
**Post date:** [March 10, 2021, 7:36pm UTC](https://discuss.dgraph.io/t/cannot-create-id-field-with-exact-index/13080/4 "2021-03-10T19:36:50Z")

</div>

This behavior is fixed and will be available in the 21.03 release.  
Now, we overwrite the default `hash` index with the `exact` index for a field of type `String! @id @search(by:[exact])`  
PR:[fix(GRAPHQL): fix query rewriting for multiple order on nested field (#7523) by JatinDevDG · Pull Request #7536 · dgraph-io/dgraph · GitHub](https://github.com/dgraph-io/dgraph/pull/7536)
