Skip to content

Instantly share code, notes, and snippets.

@node-monk
Created December 14, 2014 14:38
Show Gist options
  • Save node-monk/bee39b1a535683798db7 to your computer and use it in GitHub Desktop.
Save node-monk/bee39b1a535683798db7 to your computer and use it in GitHub Desktop.
ElasticSearch putMappings format.
18 esClient.indices.create({
19 index: 'content'
20 });
21
22 //create a mapping
23 esClient.indices.putMapping({
24 index: 'content',
25 type:'blog',
26 body: {
27 blog:{
28 properties:{
29 contentId: {
30 type: 'string',
31 index: 'no'
32 },
33 title: {
34 type: 'string'
35 },
36 slug: {
37 type: 'string',
38 index: 'no'
39 },
40 categoryName: {
41 type: 'string'
42 },
43 categorySlug: {
44 type: 'string',
45 index: 'no'
46 },
47 body: {
48 type: 'string'
49 },
50 teaser: {
51 type: 'string'
52 },
53 relTerms: {
54 'properties': {
55 name: {
56 type: 'string'
57 },
58 slug: {
59 type: 'string',
60 index: 'no'
61 }
62 }
63 },
64 dateCreated: {
65 type: 'date',
66 index:'no'
67 },
68 datePublished: {
69 type: 'date',
70 index:'no'
71 },
72 createdByUser: {
73 type: 'string',
74 index:'no'
75 },
76 featureImage: {
77 type: 'string',
78 index:'no'
79 }
80 }
81 }
82 }
83 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment