es
  1. index
es
  • analyze
    • 测试分词器
      GET
  • index
    • 创建索引及映射
      PUT
    • 查询索引
      GET
    • 删除索引
      DELETE
    • 修改索引
      PUT
  • doc
    • 创建文档
      POST
    • 查询文档
      GET
    • 删除文档
      DELETE
    • 增量修改
      POST
  • search
    • 查询全部
      GET
    • 单字段匹配
      GET
    • 多字段匹配
      GET
    • 精确匹配
      GET
    • 数值范围[匹配
      GET
    • 得分控制
      GET
    • 组合匹配
      GET
  • setting
    • aggs
      • 等值聚合
      • 平均值聚合
      • 和值聚合
      • 最小值聚合
      • 最大值聚合
    • 分页
      GET
    • 排序
      GET
    • 高亮
      GET
  1. index

创建索引及映射

开发中
PUT
/user

请求参数

Body 参数application/json
object {0}
示例
{
    "mappings": {
        "properties": {
            "id": {
                "type": "long",
                "index": "true"
            },
            "name": {
                "properties": {
                    "firstName": {
                        "type": "keyword"
                    },
                    "lastName": {
                        "type": "keyword"
                    }
                }
            },
            "birthDay": {
                "type": "date"
            },
            "introduce": {
                "type": "text",
                "index": "true",
                "analyzer": "ik_smart"
            },
            "email": {
                "type": "keyword",
                "index": "false"
            },
            "score": {
                "type": "integer",
                "index": "true"
            },
            "gender": {
                "type": "integer",
                "index": "true"
            },
            "is_health": {
                "type": "boolean",
                "index": false
            },
            "height": {
                "type": "float",
                "index": "false"
            },
            "addr":{
                "type":"keyword",
                "index":true
            }
        }
    }
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request PUT 'http://hx:9200/user' \
--header 'Content-Type: application/json' \
--data-raw '{
    "mappings": {
        "properties": {
            "id": {
                "type": "long",
                "index": "true"
            },
            "name": {
                "properties": {
                    "firstName": {
                        "type": "keyword"
                    },
                    "lastName": {
                        "type": "keyword"
                    }
                }
            },
            "birthDay": {
                "type": "date"
            },
            "introduce": {
                "type": "text",
                "index": "true",
                "analyzer": "ik_smart"
            },
            "email": {
                "type": "keyword",
                "index": "false"
            },
            "score": {
                "type": "integer",
                "index": "true"
            },
            "gender": {
                "type": "integer",
                "index": "true"
            },
            "is_health": {
                "type": "boolean",
                "index": false
            },
            "height": {
                "type": "float",
                "index": "false"
            },
            "addr":{
                "type":"keyword",
                "index":true
            }
        }
    }
}'

返回响应

🟢200成功
application/json
Body
acknowledged
boolean 
必需
shards_acknowledged
boolean 
必需
index
string 
必需
示例
{
    "acknowledged": true,
    "shards_acknowledged": true,
    "index": "string"
}
上一页
测试分词器
下一页
查询索引
Built with