@@ -64,6 +64,14 @@ to learn more about the available connection options.
6464{{< clients-example py_home_json connect >}}
6565{{< /clients-example >}}
6666
67+ The example uses an index called ` idx:users ` for JSON documents and adds
68+ some JSON documents with the ` user: ` key prefix. To avoid errors, first
69+ delete any existing index or documents whose names that might
70+ conflict with the example:
71+
72+ {{< clients-example py_home_json cleanup_json >}}
73+ {{< /clients-example >}}
74+
6775Create an index for the JSON data. The code below specifies that only JSON documents with
6876the key prefix ` user: ` are indexed. For more information, see
6977[ Query syntax] ({{< relref "/develop/ai/search-and-query/query/" >}}).
@@ -111,9 +119,16 @@ need to specify some slightly different options.
111119When you create the schema for a hash index, you don't need to
112120add aliases for the fields, since you use the basic names to access
113121the fields anyway. Also, you must use ` HASH ` for the ` IndexType `
114- when you create the index. The code below shows these changes with
115- a new index called ` hash-idx:users ` , which is otherwise the same as
116- the ` idx:users ` index used for JSON documents in the previous examples.
122+ when you create the index.
123+
124+ First delete any existing index or documents
125+ whose names might conflict with the hash example:
126+
127+ {{< clients-example py_home_json cleanup_hash >}}
128+ {{< /clients-example >}}
129+
130+ Create a new index called ` hash-idx:users ` , which is otherwise the same as
131+ the ` idx:users ` index used for JSON documents in the previous examples:
117132
118133{{< clients-example py_home_json make_hash_index >}}
119134{{< /clients-example >}}
0 commit comments