# Neo4j graph blind search for any node and relationship containing an expression?

**URL:** https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873
**Category:** Drivers & Stacks
**Tags:** migrated
**Created:** [August 21, 2022, 11:48am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873 "2022-08-21T11:48:11Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![steves](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@steves](https://community.neo4j.com/u/steves)
#### Post date: [August 21, 2022, 11:48am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/1 "2022-08-21T11:48:11Z")

</div>

I am trying to build a blind search, given an expression/string.

Using Python Neo4j driver I am running:

```python
from neo4j import GraphDatabase
driver = GraphDatabase.driver("neo4j://localhost:7687")
def query_engine(tx, query):
    res = tx.run(query)
    values = [record for record in res]
    return values

def fuzzy_search(tx, search_expression):
    query = f"MATCH (n) WHERE ANY(x in keys(n) WHERE n[x] =~ '(i?){search_expression}.*') RETURN n"
    res = query_engine(tx, query)
    return res

with driver.session() as session:
    result = session.read_transaction(fuzzy_search, "kuku.*")

driver.close()

```

I know I need to add full text index to make it faster, please advise what is the best practice to define the full text index in Neo4j when I want to perform full graph search on the nodes/relations params? For example, I am searching for 'kuku' in my graph across all nodes and relations and if there are any nodes/relations that contain kuku, I would like to be able to return it as a result.

**Additional info:** _I have added to all my nodes an additional label (FTIndex) and I am able to create a full text index, BUT(!), how can I config it to index ALL nodes available params + to be sure it will be updated if I will add new ones?_

---

<div class="post-metadata">

### Author: ![steves](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@steves](https://community.neo4j.com/u/steves)
#### Post date: [August 21, 2022, 2:34pm UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/2 "2022-08-21T14:34:09Z")

</div>

[@tony\_chiboucas](https://community.neo4j.com/t5/user/viewprofilepage/user-id/9541) [@rouven\_bauer](https://community.neo4j.com/t5/user/viewprofilepage/user-id/7004) [@michael\_hunger](https://community.neo4j.com/t5/user/viewprofilepage/user-id/1880) [@david\_allen](https://community.neo4j.com/t5/user/viewprofilepage/user-id/1896) can you please assist?

---

<div class="post-metadata">

### Author: ![steves](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@steves](https://community.neo4j.com/u/steves)
#### Post date: [August 22, 2022, 10:04am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/3 "2022-08-22T10:04:50Z")

</div>

Thanks a lot [@rouven\_bauer](https://community.neo4j.com/t5/user/viewprofilepage/user-id/7004)

---

<div class="post-metadata">

### Author: ![rouven\_bauer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rouven_bauer/32/16547_2.png) [@rouven\_bauer](https://community.neo4j.com/u/rouven_bauer)
#### Post date: [August 22, 2022, 10:02am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/4 "2022-08-22T10:02:50Z")

</div>

\> [@rouven\_bauer](https://community.neo4j.com/t5/user/viewprofilepage/user-id/7004) cold mention? I am just trying to find an answer...

Derived from cold calling: contacting someone proactively without them being engaged in the conversation before.

As for the rest, I'm afraid I'm still not the right person to answer. It seems like it might not be possible [https://stackoverflow.com/questions/36560014/neo4j-create-index-for-nodes-with-same-property](https://stackoverflow.com/questions/36560014/neo4j-create-index-for-nodes-with-same-property) (not exactly what you asked for, but suggests that you need a common label at least). Neither could I find a way to create an index for "all properties". But don't quote me on that. Again, I'm not a Cypher expert.

---

<div class="post-metadata">

### Author: ![steves](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@steves](https://community.neo4j.com/u/steves)
#### Post date: [August 22, 2022, 7:19am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/5 "2022-08-22T07:19:20Z")

</div>

[@rouven\_bauer](https://community.neo4j.com/t5/user/viewprofilepage/user-id/7004) cold mention? I am just trying to find an answer...

I am aware of all the links and knowledge you've shared, I am way after this research..I know about fulltext search index, this is not the question. Given a graph and I want to search across all nodes and relations on their parameters the string "kuku" I want it to run fast on a large graph.

I can create such index for every group of nodes/relations with the same set of params but then I will need some controller to decide which index to use.

When I create such index, it has a name, and in order to use it, I need to call a specific index, how do I know which one of N I have created is the right one?

My question is deeper than it maybe seems at the first sight. Please advise.

---

<div class="post-metadata">

### Author: ![rouven\_bauer](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rouven_bauer/32/16547_2.png) [@rouven\_bauer](https://community.neo4j.com/u/rouven_bauer)
#### Post date: [August 22, 2022, 6:07am UTC](https://community.neo4j.com/t/neo4j-graph-blind-search-for-any-node-and-relationship-containing-an-expression/59873/6 "2022-08-22T06:07:00Z")

</div>

- Pleas don't cold mention people. Thanks.
- I'm a driver author not a kernel dev. I only know fundamental Cypher.
- I googled [https://www.google.com/search?q=neo4j%20fulltext%20index](https://www.google.com/search?q=neo4j%20fulltext%20index) and the first 2 hits seem very relevant: [https://neo4j.com/developer/kb/fulltext-search-in-neo4j/](https://neo4j.com/developer/kb/fulltext-search-in-neo4j/) and [https://neo4j.com/docs/cypher-manual/current/indexes-for-full-text-search/](https://neo4j.com/docs/cypher-manual/current/indexes-for-full-text-search/)
