# Сan't make a variable Dgraph

**URL:** <https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113>\
**Category:** GraphQL\
**Created:** [July 28, 2021, 4:43pm UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113 "2021-07-28T16:43:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yemelyanov.eduard](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/yemelyanov.eduard/32/8577_2.png) [@yemelyanov.eduard](https://discuss.dgraph.io/u/yemelyanov.eduard)\
**Post date:** [July 28, 2021, 4:43pm UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/1 "2021-07-28T16:43:49Z")

</div>

```auto
query MyQuery {
  queryProduct(filter: {has: name}) {
    id
  }
}

```

Please tell me a variable to this.  
`{"variables": {"filter": { "name": { "eq": "note" } }}}` - it is not right  
Thanks in advance!!!

---

<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:** [July 28, 2021, 10:50pm UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/2 "2021-07-28T22:50:01Z")

</div>

Maybe something like this

```auto
query MyQuery($filter: ProductFilter) {
	queryProduct(filter: $filter) {
		id
	}
}

```

```auto
{"variables": {"filter": { "name": { "eq": "note" } }}}

```

See [https://dgraph.io/docs/graphql/api/variables/](https://dgraph.io/docs/graphql/api/variables/)

---

<div class="post-metadata">

**Author:** ![yemelyanov.eduard](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/yemelyanov.eduard/32/8577_2.png) [@yemelyanov.eduard](https://discuss.dgraph.io/u/yemelyanov.eduard)\
**Post date:** [July 29, 2021, 5:17am UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/4 "2021-07-29T05:17:00Z")

</div>

```auto
type Product {
	id: ID! 
	name: String! @search(by:[hash]) 
	quantity: Int! 
	availability: Boolean! 
	price: Float! 
	image_src: String! 
	category: [Category] 
	brand: Brand 
	specification: [About] 
	description_shot: String 
	description_long: String 
}

```

With this query, I can organize a search for “hash” according to the given scheme?

---

<div class="post-metadata">

**Author:** ![yemelyanov.eduard](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/yemelyanov.eduard/32/8577_2.png) [@yemelyanov.eduard](https://discuss.dgraph.io/u/yemelyanov.eduard)\
**Post date:** [July 29, 2021, 5:19am UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/5 "2021-07-29T05:19:12Z")

</div>

It works! But it just returns “id” by “name”. I need a search.

---

<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:** [July 29, 2021, 2:52pm UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/6 "2021-07-29T14:52:41Z")

</div>

If you have new questions/issues(unrelated to core of this one) we prefer that you create a new ticket.

Cheers.

---

<div class="post-metadata">

**Author:** ![yemelyanov.eduard](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/yemelyanov.eduard/32/8577_2.png) [@yemelyanov.eduard](https://discuss.dgraph.io/u/yemelyanov.eduard)\
**Post date:** [July 29, 2021, 3:32pm UTC](https://discuss.dgraph.io/t/ant-make-a-variable-dgraph/15113/7 "2021-07-29T15:32:19Z")

</div>

ok.
