# Problem with adding facets

**URL:** <https://discuss.dgraph.io/t/problem-with-adding-facets/11691>\
**Category:** Dgraph\
**Tags:** kind:question, dgraph, area:facets\
**Created:** [December 1, 2020, 5:53pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691 "2020-12-01T17:53:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![starrett67](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/starrett67/32/5533_2.png) [@starrett67](https://discuss.dgraph.io/u/starrett67)\
**Post date:** [December 1, 2020, 5:53pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/1 "2020-12-01T17:53:10Z")

</div>

I’m having some issues adding facets to an edge in my graph. The mutation seems to work but I am unable to query for the facet. Here is my mutation (all the uids already exist):

```auto
{
  "set": {
        "uid": "0x62da3",
        "catalog": [
          {
            "uid": "0x1b4"
          },
          {
            "uid": "0x1d6"
          },
          {
            "uid": "0x281"
          },
          {
            "uid": "0x2e5"
          }
        ],
        "catalog|shipping": {
          "0": "ITEM",
          "1": "ITEM",
          "2": "ITEM",
          "3": "ITEM"
        }
    }
}

```

Which successfully gives me a response:

```auto
{
  "data": {
    "code": "Success",
    "message": "Done",
    "queries": null,
    "uids": {}
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 59000,
      "processing_ns": 17881600,
      "assign_timestamp_ns": 2207800,
      "total_ns": 20393000
    },
    "txn": {
      "start_ts": 974,
      "commit_ts": 975,
      "preds": [
        "1-catalog"
      ]
    }
  }
}

```

So then I try to test that the facet exists with this query:

```auto
{
  products(func: uid(0x62da3)) {
    uid
    catalog @facets {
      uid
      region.name
		}
	}
}

```

But I do not see any facets in the response:

```auto
{
  "data": {
    "products": [
      {
        "uid": "0x62da3",
        "catalog": [
          {
            "uid": "0x1b4",
            "region.name": "FL"
          },
          {
            "uid": "0x1d6",
            "region.name": "OOM"
          },
          {
            "uid": "0x281",
            "region.name": "TX"
          },
          {
            "uid": "0x2e5",
            "region.name": "SE"
          }
        ]
      }
    ]
  },
  "extensions": {
    "server_latency": {
      "parsing_ns": 252100,
      "processing_ns": 3035100,
      "encoding_ns": 285000,
      "assign_timestamp_ns": 9195000,
      "total_ns": 13182800
    },
    "txn": {
      "start_ts": 978
    },
    "metrics": {
      "num_uids": {
        "": 1,
        "_total": 11,
        "catalog": 1,
        "region.name": 4,
        "uid": 5
      }
    }
  }
}

```

Any idea what im doing wrong here?

---

<div class="post-metadata">

**Author:** ![starrett67](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/starrett67/32/5533_2.png) [@starrett67](https://discuss.dgraph.io/u/starrett67)\
**Post date:** [December 1, 2020, 5:55pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/2 "2020-12-01T17:55:52Z")

</div>

I just found this other post so going to try this:

> [@Bug: Adding Facets via JSON](http://discuss.hypermode.com/t/bug-adding-facets-via-json/11582):
>
> I’m attempting to create facets via JSON using the method outlined here: [https://dgraph.io/docs/master/mutations/json-mutation-format/#facets-in-list-type-with-json](https://dgraph.io/docs/master/mutations/json-mutation-format/#facets-in-list-type-with-json) but it’s only working when using RDF \_:Person \<friends\> \_:Friend (order=0). Using the JSON version doesn’t create the facet: { "set": [{ "uid": "\_:Person", "name": "Julian", "friends": [{"uid": "\_:Friend", "name": "Bob"}], "friends|order": { "0": 0 } } ] }

I think there may be a gap in the documentation or for this

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [December 1, 2020, 6:40pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/3 "2020-12-01T18:40:30Z")

</div>

Pinging [@docs](https://discuss.dgraph.io/groups/docs)

---

<div class="post-metadata">

**Author:** ![damian](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/damian/32/4911_2.png) [@damian](https://discuss.dgraph.io/u/damian)\
**Post date:** [December 1, 2020, 10:41pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/4 "2020-12-01T22:41:56Z")

</div>

@MichelDiz, is this a bug on Dgraph? or is it only an issue in our docs?

---

<div class="post-metadata">

**Author:** ![MichelDiz](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/micheldiz/32/11873_2.png) [@MichelDiz](https://discuss.dgraph.io/u/MichelDiz)\
**Post date:** [December 2, 2020, 12:00am UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/5 "2020-12-02T00:00:18Z")

</div>

Maybe is confusion in our docs. Both ways in the context of this post are possible. Need to know where is the problem.

The first facets example should be possible, but we have rolled back the “new” format to the “old” one. There is a whole RFC in that context. As far I remember both syntaxes are possible. If for some reason it is not working or not possible anymore. This should be fixed in our docs.

---

<div class="post-metadata">

**Author:** ![starrett67](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/starrett67/32/5533_2.png) [@starrett67](https://discuss.dgraph.io/u/starrett67)\
**Post date:** [December 3, 2020, 10:15pm UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/6 "2020-12-03T22:15:29Z")

</div>

Sorry for going ghost here but yeah the way I tried in this thread did not work for 20.07

---

<div class="post-metadata">

**Author:** ![Arandolph543](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@Arandolph543](https://discuss.dgraph.io/u/Arandolph543)\
**Post date:** [December 4, 2020, 1:18am UTC](https://discuss.dgraph.io/t/problem-with-adding-facets/11691/7 "2020-12-04T01:18:56Z")

</div>

Starrett67 There is a really great YouTube in the Dgraph channel I happened to watch someone fo through this exact problem and it is how you requested. The video states it’s not Dgraph intuitive it’s more like a typical network GET flag request with a little Dgraph. Your request likely didn’t create the facet. But if you request with the right format you can see 0 response that tells there wasn’t a created or it then a description if you actual did. It was found just searching Dgraph so I recommend looking there if I didn’t help answer the question but try updating the request.
