• es查询例子


    创建索引和类型

    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

  • 相关阅读:
    条件注释判断浏览器版本<!--[if lt IE 9]>
    动态加载js、css 代码
    C趣味题目
    shell脚本
    Logiscope学习网址
    将double型小数点后面多余的零去掉
    qt和makefile学习网址
    微软推出的工作流引擎
    java例子
    js 定义hash类
  • 原文地址:https://www.cnblogs.com/dongma/p/13611215.html
Copyright © 2020-2023  润新知