> For the complete documentation index, see [llms.txt](https://gchandra.gitbook.io/big-data-and-tools-with-nosql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gchandra.gitbook.io/big-data-and-tools-with-nosql/nosql/redis/redis-search.md).

# Redis Search

Redis Search is a&#x20;

* A rich query language
* Full-text search
* Geospatial queries
* Aggregations

For searching first you have to create INDEXES

```
FT.CREATE {index_name} ON JSON SCHEMA {json_path} AS {attribute} {type}
```

* `<indexName>`: The name of the index you are creating.
* `[ON <structure>]`: Specifies the data structure to index, which can be `HASH` (default) or `JSON` if you're indexing JSON documents with RedisJSON.
* `[PREFIX count <prefix> ...]`: Defines one or more key prefixes. Only keys that match the prefix(es) will be indexed.
* `SCHEMA`: Followed by one or more field definitions.
* `<field>`: The name of the field to index.
* `<type>`: The type of the field (`TEXT`, `NUMERIC`, `GEO`, or `TAG`).

```
FT.CREATE idx:friends ON JSON PREFIX 1 "friends:character:" SCHEMA $.friends[*] AS friend TAG
```

```
FT.SEARCH idx:friends "@friend:{Joey Tribbiani}"
```

```
FT.CREATE idx:occupation ON JSON PREFIX 1 "friends:character:" SCHEMA $.occupation AS occupation TEXT
```

```
FT.SEARCH idx:occupation "*"

FT.SEARCH idx:occupation "Chef"
```

```
FT.INFO idx:occupation
```
