ElasticSearch:使用多种映射类型进行索引

时间:2015-11-20 23:37:30

标签: post indexing get mapping elasticsearch

我试图在ElasticSearch中完全理解使用多种映射类型的索引。在文档中,它给出了示例代码:

PUT my_index 
{
  "mappings": {
    "user": { 
      "_all":       { "enabled": false  }, 
      "properties": { 
        "title":    { "type": "string"  }, 
        "name":     { "type": "string"  }, 
        "age":      { "type": "integer" }  
      }
    },
    "blogpost": { 
      "properties": { 
        "title":    { "type": "string"  }, 
        "body":     { "type": "string"  }, 
        "user_id":  {
          "type":   "string", 
          "index":  "not_analyzed"
        },
        "created":  {
          "type":   "date", 
          "format": "strict_date_optional_time||epoch_millis"
        }
      }
    }
  }
}

通过这种映射,我将如何创建和搜索对象?

对于创造,它将是:

POST my_index/user/blogspot

POST my_index/user,blogspot

搜索它会是:

GET my_index/user/blogspot

GET my_index/user,blogspot

或其他什么?

具有多个映射的POST和GET的示例将真正帮助我。非常感谢你!

0 个答案:

没有答案