PluginProbe
ElasticPress / 4.5.1
ElasticPress v4.5.1
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / includes / mappings / comment / 7-0.php

7-0.php in ElasticPress 4.5.1, at includes/mappings/comment/7-0.php

340 lines 8.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Elasticsearch mapping for comments
4 *
5 * @since 3.6.0
6 * @package elasticpress
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 return [
14 'settings' => [
15 /**
16 * Filter number of Elasticsearch shards to use in indices
17 *
18 * @hook ep_default_index_number_of_shards
19 * @param {int} $shards Number of shards
20 * @return {int} New number
21 */
22 'index.number_of_shards' => apply_filters( 'ep_default_index_number_of_shards', 5 ),
23 /**
24 * Filter number of Elasticsearch replicas to use in indices
25 *
26 * @hook ep_default_index_number_of_replicas
27 * @param {int} $replicas Number of replicas
28 * @return {int} New number
29 */
30 'index.number_of_replicas' => apply_filters( 'ep_default_index_number_of_replicas', 1 ),
31 /**
32 * Filter Elasticsearch total field limit for users
33 *
34 * @hook ep_total_field_limit
35 * @param {int} $number Number of fields
36 * @return {int} New number
37 */
38 'index.mapping.total_fields.limit' => apply_filters( 'ep_comment_total_field_limit', 5000 ),
39 /**
40 * Filter Elasticsearch max result window for users
41 *
42 * @hook ep_user_max_result_window
43 * @param {int} $number Size of result window
44 * @return {int} New number
45 */
46 'index.max_result_window' => apply_filters( 'ep_comment_max_result_window', 1000000 ),
47 /**
48 * Filter whether Elasticsearch ignores malformed fields or not.
49 *
50 * @hook ep_ignore_malformed
51 * @param {bool} $ignore True for ignore
52 * @return {bool} New value
53 */
54 'index.mapping.ignore_malformed' => apply_filters( 'ep_ignore_malformed', true ),
55 /**
56 * Filter Elasticsearch maximum shingle difference
57 *
58 * @hook ep_max_shingle_diff
59 * @param {int} $number Max difference
60 * @return {int} New number
61 */
62 'index.max_shingle_diff' => apply_filters( 'ep_max_shingle_diff', 8 ),
63 'analysis' => [
64 'analyzer' => [
65 'default' => [
66 'tokenizer' => 'standard',
67 'filter' => [ 'ewp_word_delimiter', 'lowercase', 'stop', 'ewp_snowball' ],
68 /**
69 * Filter Elasticsearch default language in mapping
70 *
71 * @hook ep_analyzer_language
72 * @param {string} $lang Default language
73 * @param {string} $lang_context Language context
74 * @return {string} New language
75 */
76 'language' => apply_filters( 'ep_analyzer_language', 'english', 'analyzer_default' ),
77 ],
78 'shingle_analyzer' => [
79 'type' => 'custom',
80 'tokenizer' => 'standard',
81 'filter' => [ 'lowercase', 'shingle_filter' ],
82 ],
83 'ewp_lowercase' => [
84 'type' => 'custom',
85 'tokenizer' => 'keyword',
86 'filter' => [ 'lowercase' ],
87 ],
88 ],
89 'filter' => [
90 'shingle_filter' => [
91 'type' => 'shingle',
92 'min_shingle_size' => 2,
93 'max_shingle_size' => 5,
94 ],
95 'ewp_word_delimiter' => [
96 'type' => 'word_delimiter_graph',
97 'preserve_original' => true,
98 ],
99 'ewp_snowball' => [
100 'type' => 'snowball',
101 /**
102 * Filter Elasticsearch default language in mapping
103 *
104 * @hook ep_analyzer_language
105 * @param {string} $lang Default language
106 * @param {string} $lang_context Language context
107 * @return {string} New language
108 */
109 'language' => apply_filters( 'ep_analyzer_language', 'english', 'filter_ewp_snowball' ),
110 ],
111 'edge_ngram' => [
112 'side' => 'front',
113 'max_gram' => 10,
114 'min_gram' => 3,
115 'type' => 'edge_ngram',
116 ],
117 ],
118 'normalizer' => [
119 'lowerasciinormalizer' => [
120 'type' => 'custom',
121 'filter' => [ 'lowercase', 'asciifolding' ],
122 ],
123 ],
124 ],
125 ],
126 'mappings' => [
127 'date_detection' => false,
128 'dynamic_templates' => [
129 [
130 'template_meta_types' => [
131 'path_match' => 'meta.*',
132 'mapping' => [
133 'type' => 'object',
134 'properties' => [
135 'value' => [
136 'type' => 'text',
137 'fields' => [
138 'sortable' => [
139 'type' => 'keyword',
140 'ignore_above' => 10922,
141 'normalizer' => 'lowerasciinormalizer',
142 ],
143 'raw' => [
144 'type' => 'keyword',
145 'ignore_above' => 10922,
146 ],
147 ],
148 ],
149 'raw' => [ /* Left for backwards compat */
150 'type' => 'keyword',
151 'ignore_above' => 10922,
152 ],
153 'long' => [
154 'type' => 'long',
155 ],
156 'double' => [
157 'type' => 'double',
158 ],
159 'boolean' => [
160 'type' => 'boolean',
161 ],
162 'date' => [
163 'type' => 'date',
164 'format' => 'yyyy-MM-dd',
165 ],
166 'datetime' => [
167 'type' => 'date',
168 'format' => 'yyyy-MM-dd HH:mm:ss',
169 ],
170 'time' => [
171 'type' => 'date',
172 'format' => 'HH:mm:ss',
173 ],
174 ],
175 ],
176 ],
177 ],
178 ],
179 'properties' => [
180 'comment_ID' => [
181 'type' => 'long',
182 ],
183 'ID' => [
184 'type' => 'long',
185 ],
186 'comment_post_ID' => [
187 'type' => 'long',
188 ],
189 'comment_post_author_ID' => [
190 'type' => 'long',
191 ],
192 'comment_post_status' => [
193 'type' => 'keyword',
194 ],
195 'comment_post_type' => [
196 'type' => 'text',
197 'fields' => [
198 'comment_post_type' => [
199 'type' => 'text',
200 ],
201 'raw' => [
202 'type' => 'keyword',
203 ],
204 ],
205 ],
206 'comment_post_name' => [
207 'type' => 'text',
208 'fields' => [
209 'comment_post_name' => [
210 'type' => 'text',
211 ],
212 'raw' => [
213 'type' => 'keyword',
214 'ignore_above' => 10922,
215 ],
216 ],
217 ],
218 'comment_post_parent' => [
219 'type' => 'long',
220 ],
221 'comment_author' => [
222 'type' => 'text',
223 'fields' => [
224 'comment_author' => [
225 'type' => 'text',
226 ],
227 'raw' => [
228 'type' => 'keyword',
229 'ignore_above' => 10922,
230 ],
231 ],
232 ],
233 'comment_author_email' => [
234 'type' => 'text',
235 'fields' => [
236 'comment_author_email' => [
237 'type' => 'text',
238 ],
239 'raw' => [
240 'type' => 'keyword',
241 'ignore_above' => 10922,
242 ],
243 ],
244 ],
245 'comment_author_url' => [
246 'type' => 'text',
247 'fields' => [
248 'comment_author_url' => [
249 'type' => 'text',
250 ],
251 'raw' => [
252 'type' => 'keyword',
253 'ignore_above' => 10922,
254 ],
255 ],
256 ],
257 'comment_author_IP' => [
258 'type' => 'text',
259 'fields' => [
260 'comment_author_IP' => [
261 'type' => 'text',
262 ],
263 'raw' => [
264 'type' => 'keyword',
265 'ignore_above' => 10922,
266 ],
267 ],
268 ],
269 'comment_date' => [
270 'type' => 'date',
271 'format' => 'yyyy-MM-dd HH:mm:ss',
272 ],
273 'comment_date_gmt' => [
274 'type' => 'date',
275 'format' => 'yyyy-MM-dd HH:mm:ss',
276 ],
277 'comment_content' => [
278 'type' => 'text',
279 'fields' => [
280 'comment_content' => [
281 'type' => 'text',
282 ],
283 'raw' => [
284 'type' => 'keyword',
285 'ignore_above' => 10922,
286 ],
287 ],
288 ],
289 'comment_karma' => [
290 'type' => 'long',
291 ],
292 'comment_approved' => [
293 'type' => 'text',
294 'fields' => [
295 'comment_approved' => [
296 'type' => 'text',
297 ],
298 'raw' => [
299 'type' => 'keyword',
300 'ignore_above' => 10922,
301 ],
302 ],
303 ],
304 'comment_agent' => [
305 'type' => 'text',
306 'fields' => [
307 'comment_agent' => [
308 'type' => 'text',
309 ],
310 'raw' => [
311 'type' => 'keyword',
312 'ignore_above' => 10922,
313 ],
314 ],
315 ],
316 'comment_type' => [
317 'type' => 'text',
318 'fields' => [
319 'comment_type' => [
320 'type' => 'text',
321 ],
322 'raw' => [
323 'type' => 'keyword',
324 'ignore_above' => 10922,
325 ],
326 ],
327 ],
328 'comment_parent' => [
329 'type' => 'long',
330 ],
331 'user_id' => [
332 'type' => 'long',
333 ],
334 'meta' => [
335 'type' => 'object',
336 ],
337 ],
338 ],
339 ];
340