Просмотр исходного кода

Merge branch 'es_scheme_update' into compat-es-2-and-5

Norio Suzuki 9 лет назад
Родитель
Сommit
ffd3a806ea
3 измененных файлов с 54 добавлено и 18 удалено
  1. 5 0
      resource/search/dummy_doc.json
  2. 7 0
      resource/search/dummy_query.json
  3. 42 18
      resource/search/mappings.json

+ 5 - 0
resource/search/dummy_doc.json

@@ -0,0 +1,5 @@
+{
+    "path": "/user/hasete2",
+    "body": "ハロー, hello",
+    "username": "hasete2"
+}

+ 7 - 0
resource/search/dummy_query.json

@@ -0,0 +1,7 @@
+{
+    "query": {
+        "match": {
+            "body_ja": "ハロー"
+        }
+    }
+}

+ 42 - 18
resource/search/mappings.json

@@ -40,46 +40,70 @@
       "properties" : {
         "name": {
           "type": "string",
-          "analyzer": "autocomplete"
+          "analyzer": "autocomplete",
+          "include_in_all": false
         }
       }
     },
     "pages": {
       "properties" : {
         "path": {
-          "type" : "multi_field",
-          "fields" : {
-            "raw": {"type" : "string", "index" : "not_analyzed"},
-            "ja": {"type" : "string", "analyzer" : "kuromoji"},
-            "en": {"type" : "string", "analyzer" : "english"}
-          }
+          "type": "string",
+          "copy_to": ["path_ja", "path_en"],
+          "include_in_all": false,
+          "index": "not_analyzed"
+        },
+        "path_ja": {
+          "type": "string",
+          "analyzer": "kuromoji",
+          "include_in_all": false
+        },
+        "path_en": {
+          "type": "string",
+          "analyzer": "english",
+          "include_in_all": false
         },
         "body": {
-          "type" : "multi_field",
-          "fields" : {
-            "ja": {"type" : "string", "analyzer" : "kuromoji"},
-            "en": {"type" : "string", "analyzer" : "english"}
-          }
+          "type": "string",
+          "copy_to": ["body_ja", "body_en"],
+          "include_in_all": false,
+          "index": "not_analyzed"
+        },
+        "body_ja": {
+          "type": "string",
+          "analyzer": "kuromoji",
+          "include_in_all": false
+        },
+        "body_en": {
+          "type": "string",
+          "analyzer": "english",
+          "include_in_all": false
         },
         "username": {
-          "type": "string"
+          "type": "string",
+          "include_in_all": false
         },
         "comment_count": {
-          "type": "integer"
+          "type": "integer",
+          "include_in_all": false
         },
         "bookmark_count": {
-          "type": "integer"
+          "type": "integer",
+          "include_in_all": false
         },
         "like_count": {
-          "type": "integer"
+          "type": "integer",
+          "include_in_all": false
         },
         "created_at": {
           "type": "date",
-          "format": "dateOptionalTime"
+          "format": "dateOptionalTime",
+          "include_in_all": false
         },
         "updated_at": {
           "type": "date",
-          "format": "dateOptionalTime"
+          "format": "dateOptionalTime",
+          "include_in_all": false
         }
       }
     }