创建索引和类型
GET /lib3/user { "mappings" : { "user":{ "properties":{ "name":{"type":"text"}, "address":{"type":"text"}, "age":{"type":"integer"}, "interests":{"type":"text"}, "bibrthday":{"type":"date"} } } } }
添加数据
PUT /lib3/user/6 { "name": "张三", "address": "北京海淀区清河", "age": 29, "bibrthday": "1998-10-12", "interests": "喜欢摄影,听音乐,跳舞" } { "name": "赵明", "address": "北京海淀区清河", "age": 20, "bibrthday": "1998-10-12", "interests": "喜欢喝酒,锻炼,唱歌" } } { "name": "王五", "address": "北京海淀区清河", "age": 26, "bibrthday": "1995-10-12", "interests": "喜欢编程,听音乐,旅游" } } { "name": "赵六", "address": "黑龙江省铁岭", "age": 50, "interests": "喜欢喝酒,锻炼,说相声", "bibrthday": "1970-12-12" } } { "name": "lisi", "address": "北京海淀区清河", "age": 23, "bibrthday": "1998-10-12", "interests": "喜欢喝酒,锻炼,唱歌" }
filter 查询不计算相关性,同时可以使用cache,因此filter的速度大于query