You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/develop/clients/dotnet/queryjson.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,11 @@ to learn more about the available connection options.
60
60
{{< clients-example cs_home_json connect >}}
61
61
{{< /clients-example >}}
62
62
63
+
Delete any existing index called `idx:users` and any keys that start with `user:`.
64
+
65
+
{{< clients-example cs_home_json cleanup_json >}}
66
+
{{< /clients-example >}}
67
+
63
68
Create an index. In this example, only JSON documents with the key prefix `user:` are indexed. For more information, see [Query syntax]({{< relref "/develop/ai/search-and-query/query/" >}}).
64
69
65
70
{{< clients-example cs_home_json make_index >}}
@@ -109,6 +114,13 @@ in the `FTCreateParams` object when you create the index. The code below shows
109
114
these changes with a new index called `hash-idx:users`, which is otherwise the
110
115
same as the `idx:users` index used for JSON documents in the previous examples.
111
116
117
+
First, delete any existing index called `hash-idx:users` and any keys that start with `huser:`.
Create an index. In this example, only JSON documents with the key prefix `user:` are indexed. For more information, see [Query syntax]({{< relref "/develop/ai/search-and-query/query/" >}}).
67
72
68
73
{{< clients-example java_home_json make_index >}}
@@ -112,6 +117,13 @@ option of `FTCreateParams` when you create the index. The code below shows these
112
117
changes with a new index called `hash-idx:users`, which is otherwise the same as
113
118
the `idx:users` index used for JSON documents in the previous examples.
114
119
120
+
First, delete any existing index called `hash-idx:users` and any keys that start with `huser:`.
Create an index. In this example, only JSON documents with the key prefix `user:` are indexed. For more information, see [Query syntax]({{< relref "/develop/ai/search-and-query/query/" >}}).
93
65
94
-
```js
95
-
awaitclient.ft.create('idx:users', {
96
-
'$.name': {
97
-
type:SchemaFieldTypes.TEXT,
98
-
AS:'name'
99
-
},
100
-
'$.city': {
101
-
type:SchemaFieldTypes.TEXT,
102
-
AS:'city'
103
-
},
104
-
'$.age': {
105
-
type:SchemaFieldTypes.NUMERIC,
106
-
AS:'age'
107
-
}
108
-
}, {
109
-
ON:'JSON',
110
-
PREFIX:'user:'
111
-
});
112
-
```
66
+
First, drop any existing index to avoid a collision. (The callback is required
67
+
to avoid an error if the index doesn't already exist.)
0 commit comments