# Regexp search in graphql is not using index, and is doing a full scan, dql regexp is working properly

**URL:** <https://discuss.dgraph.io/t/regexp-search-in-graphql-is-not-using-index-and-is-doing-a-full-scan-dql-regexp-is-working-properly/14620>\
**Category:** GraphQL\
**Tags:** kind:bug\
**Created:** [June 16, 2021, 10:39pm UTC](https://discuss.dgraph.io/t/regexp-search-in-graphql-is-not-using-index-and-is-doing-a-full-scan-dql-regexp-is-working-properly/14620 "2021-06-16T22:39:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vasile\_E](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/vasile_e/32/8409_2.png) [@Vasile\_E](https://discuss.dgraph.io/u/Vasile_E)\
**Post date:** [June 16, 2021, 10:39pm UTC](https://discuss.dgraph.io/t/regexp-search-in-graphql-is-not-using-index-and-is-doing-a-full-scan-dql-regexp-is-working-properly/14620/1 "2021-06-16T22:39:49Z")

</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**
>
> ```auto
> $ dgraph version
>  
> dgraph/standalone:v21.03.0
> 
> ```

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

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

Schema  
`type Place { name: String! @search(by: [regexp]) }`

### Expected behaviour and actual result.

GraphQL query with regexp filter is scanning all the rows  
`{ queryPlace(filter: {name: {regexp: "/bucure.ti/i"}}) { name } }`  
result for graphql

`{ "data": { "queryPlace": [{ "name": "Bucureştii Noi" }, { "name": "București" }, { "name": "Bucuresti" }, { "name": "Cotul Bucureşti" }, { "name": "Municipiul Bucureşti" }] }, "extensions": { "touched_uids": 261349, "tracing": { "version": 1, "startTime": "2021-06-16T22:35:01.987425572Z", "endTime": "2021-06-16T22:35:06.523753638Z", "duration": 4536327298, "execution": { "resolvers": [{ "path": [ "queryPlace"], "parentType": "Query", "fieldName": "queryPlace", "returnType": "[Place]", "startOffset": 245354, "duration": 4536045138, "dgraph": [{ "label": "query", "startOffset": 355774, "duration": 4535928083 }] } ] } } } }`

DQL query is working as expected  
`{ place_regexp_search(func: regexp(Place.name, /bucure.ti/i)) { Place.name } }`  
result

`{ "data": { "place_regexp_search": [{ "Place.name": "Bucureştii Noi" }, { "Place.name": "București" }, { "Place.name": "Bucuresti" }, { "Place.name": "Cotul Bucureşti" }, { "Place.name": "Municipiul Bucureşti" }] }, "extensions": { "server_latency": { "parsing_ns": 76685, "processing_ns": 1431587, "encoding_ns": 45256, "assign_timestamp_ns": 643229, "total_ns": 2303263 }, "txn": { "start_ts": 50078 }, "metrics": { "num_uids": { "Place.name": 5, "_total": 5 } } } }`
