Source: includes/mappings/post/5-2.php

  1. <?php
  2. /**
  3. * Elasticsearch mapping for ES 5.2
  4. *
  5. * @since 2.4
  6. * @package elasticpress
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit; // Exit if accessed directly.
  10. }
  11. return array(
  12. 'settings' => array(
  13. /**
  14. * Filter number of Elasticsearch shards to use in indices
  15. *
  16. * @hook ep_default_index_number_of_shards
  17. * @param {int} $shards Number of shards
  18. * @return {int} New number
  19. */
  20. 'index.number_of_shards' => apply_filters( 'ep_default_index_number_of_shards', 5 ),
  21. /**
  22. * Filter number of Elasticsearch replicas to use in indices
  23. *
  24. * @hook ep_default_index_number_of_replicas
  25. * @param {int} $replicas Number of replicas
  26. * @return {int} New number
  27. */
  28. 'index.number_of_replicas' => apply_filters( 'ep_default_index_number_of_replicas', 1 ),
  29. /**
  30. * Filter Elasticsearch total field limit for posts
  31. *
  32. * @hook ep_total_field_limit
  33. * @param {int} $number Number of fields
  34. * @return {int} New number
  35. */
  36. 'index.mapping.total_fields.limit' => apply_filters( 'ep_total_field_limit', 5000 ),
  37. /**
  38. * Filter Elasticsearch max result window for posts
  39. *
  40. * @hook ep_max_result_window
  41. * @param {int} $number Size of result window
  42. * @return {int} New number
  43. */
  44. 'index.max_result_window' => apply_filters( 'ep_max_result_window', 1000000 ),
  45. 'analysis' => array(
  46. 'analyzer' => array(
  47. 'default' => array(
  48. 'tokenizer' => 'standard',
  49. /* This filter is documented in includes/mappings/post/7-0.php */
  50. 'filter' => apply_filters( 'ep_default_analyzer_filters', array( 'standard', 'ewp_word_delimiter', 'lowercase', 'ep_stop', 'ewp_snowball' ) ),
  51. /* This filter is documented in includes/mappings/post/7-0.php */
  52. 'char_filter' => apply_filters( 'ep_default_analyzer_char_filters', array( 'html_strip' ) ),
  53. /* This filter is documented in includes/mappings/post/7-0.php */
  54. 'language' => apply_filters( 'ep_analyzer_language', 'english', 'analyzer_default' ),
  55. ),
  56. 'default_search' => array(
  57. 'tokenizer' => 'standard',
  58. /* This filter is documented in includes/mappings/post/7-0.php */
  59. 'filter' => apply_filters( 'ep_default_search_analyzer_filters', array( 'standard', 'lowercase', 'ep_stop', 'ewp_snowball' ) ),
  60. /* This filter is documented in includes/mappings/post/7-0.php */
  61. 'char_filter' => apply_filters( 'ep_default_search_analyzer_char_filters', array( 'html_strip' ) ),
  62. /* This filter is documented in includes/mappings/post/7-0.php */
  63. 'language' => apply_filters( 'ep_analyzer_language', 'english', 'analyzer_default' ),
  64. ),
  65. 'shingle_analyzer' => array(
  66. 'type' => 'custom',
  67. 'tokenizer' => 'standard',
  68. 'filter' => array( 'lowercase', 'shingle_filter' ),
  69. ),
  70. 'ewp_lowercase' => array(
  71. 'type' => 'custom',
  72. 'tokenizer' => 'keyword',
  73. 'filter' => array( 'lowercase' ),
  74. ),
  75. ),
  76. 'filter' => array(
  77. 'shingle_filter' => array(
  78. 'type' => 'shingle',
  79. 'min_shingle_size' => 2,
  80. 'max_shingle_size' => 5,
  81. ),
  82. 'ewp_word_delimiter' => array(
  83. 'type' => 'word_delimiter',
  84. 'preserve_original' => true,
  85. ),
  86. 'ewp_snowball' => array(
  87. 'type' => 'snowball',
  88. /* This filter is documented in includes/mappings/post/7-0.php */
  89. 'language' => apply_filters( 'ep_analyzer_language', 'english', 'filter_ewp_snowball' ),
  90. ),
  91. 'edge_ngram' => array(
  92. 'side' => 'front',
  93. 'max_gram' => 10,
  94. 'min_gram' => 3,
  95. 'type' => 'edgeNGram',
  96. ),
  97. 'ep_stop' => [
  98. 'type' => 'stop',
  99. 'ignore_case' => true,
  100. /* This filter is documented in includes/mappings/post/7-0.php */
  101. 'stopwords' => apply_filters( 'ep_analyzer_language', 'english', 'filter_ep_stop' ),
  102. ],
  103. ),
  104. 'normalizer' => array(
  105. 'lowerasciinormalizer' => array(
  106. 'type' => 'custom',
  107. 'filter' => array( 'lowercase', 'asciifolding' ),
  108. ),
  109. ),
  110. ),
  111. ),
  112. 'mappings' => array(
  113. 'post' => array(
  114. '_meta' => array(
  115. 'mapping_version' => '5-2.php',
  116. ),
  117. 'date_detection' => false,
  118. 'dynamic_templates' => array(
  119. array(
  120. 'template_meta' => array(
  121. 'path_match' => 'post_meta.*',
  122. 'mapping' => array(
  123. 'type' => 'text',
  124. 'path' => 'full',
  125. 'fields' => array(
  126. '{name}' => array(
  127. 'type' => 'text',
  128. ),
  129. 'raw' => array(
  130. 'type' => 'keyword',
  131. 'ignore_above' => 10922,
  132. ),
  133. ),
  134. ),
  135. ),
  136. ),
  137. array(
  138. 'template_meta_types' => array(
  139. 'path_match' => 'meta.*',
  140. 'mapping' => array(
  141. 'type' => 'object',
  142. 'path' => 'full',
  143. 'properties' => array(
  144. 'value' => array(
  145. 'type' => 'text',
  146. 'fields' => array(
  147. 'sortable' => array(
  148. 'type' => 'keyword',
  149. 'ignore_above' => 10922,
  150. 'normalizer' => 'lowerasciinormalizer',
  151. ),
  152. 'raw' => array(
  153. 'type' => 'keyword',
  154. 'ignore_above' => 10922,
  155. ),
  156. ),
  157. ),
  158. 'raw' => array( /* Left for backwards compat */
  159. 'type' => 'keyword',
  160. 'ignore_above' => 10922,
  161. ),
  162. 'long' => array(
  163. 'type' => 'long',
  164. ),
  165. 'double' => array(
  166. 'type' => 'double',
  167. ),
  168. 'boolean' => array(
  169. 'type' => 'boolean',
  170. ),
  171. 'date' => array(
  172. 'type' => 'date',
  173. 'format' => 'yyyy-MM-dd',
  174. ),
  175. 'datetime' => array(
  176. 'type' => 'date',
  177. 'format' => 'yyyy-MM-dd HH:mm:ss',
  178. ),
  179. 'time' => array(
  180. 'type' => 'date',
  181. 'format' => 'HH:mm:ss',
  182. ),
  183. ),
  184. ),
  185. ),
  186. ),
  187. array(
  188. 'template_terms' => array(
  189. 'path_match' => 'terms.*',
  190. 'mapping' => array(
  191. 'type' => 'object',
  192. 'path' => 'full',
  193. 'properties' => array(
  194. 'name' => array(
  195. 'type' => 'text',
  196. 'fields' => array(
  197. 'raw' => array(
  198. 'type' => 'keyword',
  199. ),
  200. 'sortable' => array(
  201. 'type' => 'keyword',
  202. 'normalizer' => 'lowerasciinormalizer',
  203. ),
  204. ),
  205. ),
  206. 'term_id' => array(
  207. 'type' => 'long',
  208. ),
  209. 'term_taxonomy_id' => array(
  210. 'type' => 'long',
  211. ),
  212. 'parent' => array(
  213. 'type' => 'long',
  214. ),
  215. 'slug' => array(
  216. 'type' => 'keyword',
  217. ),
  218. 'facet' => array(
  219. 'type' => 'keyword',
  220. ),
  221. 'term_order' => array(
  222. 'type' => 'long',
  223. ),
  224. ),
  225. ),
  226. ),
  227. ),
  228. array(
  229. 'term_suggest' => array(
  230. 'path_match' => 'term_suggest_*',
  231. 'mapping' => array(
  232. 'type' => 'completion',
  233. 'analyzer' => 'default',
  234. ),
  235. ),
  236. ),
  237. ),
  238. '_all' => array(
  239. 'analyzer' => 'simple',
  240. ),
  241. 'properties' => array(
  242. 'post_id' => array(
  243. 'type' => 'long',
  244. ),
  245. 'ID' => array(
  246. 'type' => 'long',
  247. ),
  248. 'post_author' => array(
  249. 'type' => 'object',
  250. 'properties' => array(
  251. 'display_name' => array(
  252. 'type' => 'text',
  253. 'fields' => array(
  254. 'raw' => array(
  255. 'type' => 'keyword',
  256. ),
  257. 'sortable' => array(
  258. 'type' => 'keyword',
  259. 'normalizer' => 'lowerasciinormalizer',
  260. ),
  261. ),
  262. ),
  263. 'login' => array(
  264. 'type' => 'text',
  265. 'fields' => array(
  266. 'raw' => array(
  267. 'type' => 'keyword',
  268. ),
  269. 'sortable' => array(
  270. 'type' => 'keyword',
  271. 'normalizer' => 'lowerasciinormalizer',
  272. ),
  273. ),
  274. ),
  275. 'id' => array(
  276. 'type' => 'long',
  277. ),
  278. 'raw' => array(
  279. 'type' => 'keyword',
  280. ),
  281. ),
  282. ),
  283. 'post_date' => array(
  284. 'type' => 'date',
  285. 'format' => 'YYYY-MM-dd HH:mm:ss',
  286. ),
  287. 'post_date_gmt' => array(
  288. 'type' => 'date',
  289. 'format' => 'YYYY-MM-dd HH:mm:ss',
  290. ),
  291. 'post_title' => array(
  292. 'type' => 'text',
  293. 'fields' => array(
  294. 'post_title' => array(
  295. 'type' => 'text',
  296. 'analyzer' => 'standard',
  297. ),
  298. 'raw' => array(
  299. 'type' => 'keyword',
  300. 'ignore_above' => 10922,
  301. ),
  302. 'sortable' => array(
  303. 'type' => 'keyword',
  304. 'ignore_above' => 10922,
  305. 'normalizer' => 'lowerasciinormalizer',
  306. ),
  307. ),
  308. ),
  309. 'post_excerpt' => array(
  310. 'type' => 'text',
  311. ),
  312. 'post_password' => array(
  313. 'type' => 'text',
  314. ),
  315. 'post_content' => array(
  316. 'type' => 'text',
  317. ),
  318. 'post_content_filtered' => array(
  319. 'type' => 'text',
  320. ),
  321. 'post_status' => array(
  322. 'type' => 'keyword',
  323. ),
  324. 'post_name' => array(
  325. 'type' => 'text',
  326. 'fields' => array(
  327. 'post_name' => array(
  328. 'type' => 'text',
  329. ),
  330. 'raw' => array(
  331. 'type' => 'keyword',
  332. 'ignore_above' => 10922,
  333. ),
  334. ),
  335. ),
  336. 'post_modified' => array(
  337. 'type' => 'date',
  338. 'format' => 'YYYY-MM-dd HH:mm:ss',
  339. ),
  340. 'post_modified_gmt' => array(
  341. 'type' => 'date',
  342. 'format' => 'YYYY-MM-dd HH:mm:ss',
  343. ),
  344. 'post_parent' => array(
  345. 'type' => 'long',
  346. ),
  347. 'post_type' => array(
  348. 'type' => 'text',
  349. 'fields' => array(
  350. 'post_type' => array(
  351. 'type' => 'text',
  352. ),
  353. 'raw' => array(
  354. 'type' => 'keyword',
  355. ),
  356. ),
  357. ),
  358. 'post_mime_type' => array(
  359. 'type' => 'keyword',
  360. ),
  361. 'permalink' => array(
  362. 'type' => 'keyword',
  363. ),
  364. 'guid' => array(
  365. 'type' => 'keyword',
  366. ),
  367. 'terms' => array(
  368. 'type' => 'object',
  369. ),
  370. 'post_meta' => array(
  371. 'type' => 'object',
  372. ),
  373. 'meta' => array(
  374. 'type' => 'object',
  375. ),
  376. 'date_terms' => array(
  377. 'type' => 'object',
  378. 'properties' => array(
  379. 'year' => array( // 4 digit year (e.g. 2011).
  380. 'type' => 'integer',
  381. ),
  382. 'month' => array( // Month number (from 1 to 12) alternate name 'monthnum'.
  383. 'type' => 'integer',
  384. ),
  385. 'm' => array( // YearMonth (For e.g.: 201307).
  386. 'type' => 'integer',
  387. ),
  388. 'week' => array( // Week of the year (from 0 to 53) alternate name 'w'.
  389. 'type' => 'integer',
  390. ),
  391. 'day' => array( // Day of the month (from 1 to 31).
  392. 'type' => 'integer',
  393. ),
  394. 'dayofweek' => array( // Accepts numbers 1-7 (1 is Sunday).
  395. 'type' => 'integer',
  396. ),
  397. 'dayofweek_iso' => array( // Accepts numbers 1-7 (1 is Monday).
  398. 'type' => 'integer',
  399. ),
  400. 'dayofyear' => array( // Accepts numbers 1-366.
  401. 'type' => 'integer',
  402. ),
  403. 'hour' => array( // Hour (from 0 to 23).
  404. 'type' => 'integer',
  405. ),
  406. 'minute' => array( // Minute (from 0 to 59).
  407. 'type' => 'integer',
  408. ),
  409. 'second' => array( // Second (0 to 59).
  410. 'type' => 'integer',
  411. ),
  412. ),
  413. ),
  414. 'thumbnail' => array(
  415. 'type' => 'object',
  416. 'properties' => array(
  417. 'ID' => array(
  418. 'type' => 'long',
  419. ),
  420. 'src' => array(
  421. 'type' => 'text',
  422. ),
  423. 'width' => array(
  424. 'type' => 'integer',
  425. ),
  426. 'height' => array(
  427. 'type' => 'integer',
  428. ),
  429. 'alt' => array(
  430. 'type' => 'text',
  431. ),
  432. ),
  433. ),
  434. ),
  435. ),
  436. ),
  437. );