Skip to content

Commit ee96149

Browse files
committed
Replace slanted quotation marks with straight ones
1 parent 772deeb commit ee96149

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

docs/search/optimize-search-performance.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ sourceCategory=foo and field_a=value_a
9696

9797
### Move terms from parse statement to source expression
9898

99-
Adding the parsing terms in the source expression will help you enhance the search performance. A parse statement without `nodrop` drops the logs that could not parse the desired field. For example, `parse completed * action as actionName` will remove logs that do not have **completed** and **action** terms.
99+
Adding the parsing terms in the source expression will help you enhance the search performance. A parse statement without `nodrop` drops the logs that could not parse the desired field. For example, `parse "completed * action" as actionName` will remove logs that do not have **completed** and **action** terms.
100100

101101
**Not recommended approach:**
102102

103103
```
104104
_sourceCategory=Prod/User/Eventlog
105-
| parse completed * action as actionName
105+
| parse "completed * action" as actionName
106106
| count by actionName
107107
```
108108

109109
**Recommended approach:**
110110

111111
```
112112
_sourceCategory=Prod/User/Eventlog completed action
113-
| parse completed * action as actionName
113+
| parse "completed * action" as actionName
114114
| count by actionName
115115
```
116116

@@ -122,7 +122,7 @@ While filtering the date, reduce the result set to the smallest possible size be
122122

123123
```
124124
_sourceCategory=Prod/User/Eventlog
125-
| parse userName: *, as user
125+
| parse "userName: *, " as user
126126
| count by user
127127
| where user="john"
128128
```
@@ -131,7 +131,7 @@ _sourceCategory=Prod/User/Eventlog
131131

132132
```
133133
_sourceCategory=Prod/User/Eventlog userName
134-
| parse userName: *, as user
134+
| parse "userName: *, " as user
135135
| where user="john"
136136
| count by user
137137
```
@@ -146,16 +146,16 @@ For example, let’s say you have a `sort` operator before an aggregation, but t
146146

147147
```
148148
_sourceCategory=Prod/User/Eventlog
149-
| parse userName: *, as user
150-
| parse evenName: *, as event
149+
| parse "userName: *, " as user
150+
| parse "evenName: *, " as event
151151
| count by user
152152
```
153153

154154
**Recommended approach:**
155155

156156
```
157157
_sourceCategory=Prod/User/Eventlog
158-
| parse userName: *, as user
158+
| parse "userName: *, " as user
159159
| count by user
160160
```
161161

@@ -169,16 +169,16 @@ If the same operators are used multiple times in different levels of query, if p
169169

170170
```
171171
_sourceCategory=Prod/User/Eventlog
172-
| parse completed * action as actionName
173-
| parse action in * ms as duration
172+
| parse "completed * action" as actionName
173+
| parse "action in * ms" as duration
174174
| pct(duration, 95) by actionName
175175
```
176176

177177
**Recommended approach:**
178178

179179
```
180180
_sourceCategory=Prod/User/Eventlog
181-
| parse completed * action in * ms as actionName, duration
181+
| parse "completed * action in * ms" as actionName, duration
182182
| pct(duration, 95) by actionName
183183
```
184184

@@ -188,17 +188,17 @@ If the same operators are used multiple times in different levels of query, if p
188188

189189
```
190190
_sourceCategory=Prod/User/Eventlog
191-
| parse completed * action as actionName
192-
| where toLowerCase(actionName) = logIn” or toLowerCase(actionName) matches abc*” or toLowerCase(actionName) contains xyz"
191+
| parse "completed * action" as actionName
192+
| where toLowerCase(actionName) = "logIn” or toLowerCase(actionName) matches "abc*” or toLowerCase(actionName) contains "xyz"
193193
```
194194

195195
**Recommended approach:**
196196

197197
```
198198
_sourceCategory=Prod/User/Eventlog
199-
| parse completed * action as actionName
199+
| parse "completed * action" as actionName
200200
| toLowerCase(actionName) as actionNameLowered
201-
| where actionNameLowered = logIn” or actionNameLowered matches abc*” or actionNameLowered contains xyz”
201+
| where actionNameLowered = "logIn” or actionNameLowered matches "abc*” or actionNameLowered contains "xyz”
202202
```
203203

204204
### Use lookup on the lowest possible dataset
@@ -212,18 +212,18 @@ Minimize the data processed by the `lookup` operator in the query, as lookup is
212212

213213
```
214214
_sourceCategory=Prod/User/Eventlog
215-
| parse completed * action in * ms as actionName, duration
215+
| parse "completed * action in * ms" as actionName, duration
216216
| lookup actionType from path://"/Library/Users/[email protected]/actionTypes" on actionName
217-
| where actionName in (login”, logout”)
217+
| where actionName in ("login”, "logout”)
218218
| count by actionName, actionType
219219
```
220220

221221
**Recommended approach (Option 1):**
222222

223223
```
224224
_sourceCategory=Prod/User/Eventlog
225-
| parse completed * action in * ms as actionName, duration
226-
| where actionName in (login”, logout”)
225+
| parse "completed * action in * ms" as actionName, duration
226+
| where actionName in ("login”, "logout”)
227227
| count by actionName
228228
| lookup actionType from path://"/Library/Users/[email protected]/actionTypes" on actionName
229229
```
@@ -232,8 +232,8 @@ _sourceCategory=Prod/User/Eventlog
232232

233233
```
234234
_sourceCategory=Prod/User/Eventlog
235-
| parse completed * action in * ms as actionName, duration
236-
| where actionName in (login”, logout”)
235+
| parse "completed * action in * ms" as actionName, duration
236+
| where actionName in ("login”, "logout”)
237237
| lookup actionType from path://"/Library/Users/[email protected]/actionTypes" on actionName
238238
| count by actionName, actionType
239239
```
@@ -246,15 +246,15 @@ For example, consider the below query where the assumption is that a single log
246246

247247
```
248248
_sourceCategory=Prod/User/Eventlog
249-
| parse regex userName: (?<user>[a-z-A-Z]+), multi
250-
| parse regex eventName: (?<event>[a-z-A-Z]+), multi
249+
| parse regex "userName: (?<user>[a-z-A-Z]+), " multi
250+
| parse regex "eventName: (?<event>[a-z-A-Z]+), " multi
251251
```
252252

253253
But if you write the query like that, it will generate a result for every combination of `userName` and `eventName` values. Now suppose you want to count by `eventName`, it will not give you the desired result, since a single `eventName` has been duplicated for every `userName` in the same log. So, the better query would be:
254254

255255
```
256256
_sourceCategory=Prod/User/Eventlog
257-
| parse regex userName: (?<user>[a-z-A-Z]+), eventName: (?<event>[a-z-A-Z]+), multi
257+
| parse regex "userName: (?<user>[a-z-A-Z]+), eventName: (?<event>[a-z-A-Z]+), " multi
258258
```
259259

260260

0 commit comments

Comments
 (0)