美文网首页
ElasticSearch创建索引库文档items

ElasticSearch创建索引库文档items

作者: Leo_23 | 来源:发表于2025-03-13 14:00 被阅读0次

创建索引库

PUT /items
{
  "mappings": {
    "properties": {
      "id": {
        "type": "keyword"
      },
      "name":{
        "type": "text",
        "analyzer": "ik_max_word"
      },
      "price":{
        "type": "integer"
      },
      "stock":{
        "type": "integer"
      },
      "image":{
        "type": "keyword",
        "index": false
      },
      "category":{
        "type": "keyword"
      },
      "brand":{
        "type": "keyword"
      },
      "sold":{
        "type": "integer"
      },
      "commentCount":{
        "type": "integer",
        "index": false
      },
      "isAD":{
        "type": "boolean"
      },
      "updateTime":{
        "type": "date"
      }
    }
  }
}

查看索引库结构

GET /items

结果

#! Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.
{
  "items" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "brand" : {
          "type" : "keyword"
        },
        "category" : {
          "type" : "keyword"
        },
        "commentCount" : {
          "type" : "integer",
          "index" : false
        },
        "id" : {
          "type" : "keyword"
        },
        "image" : {
          "type" : "keyword",
          "index" : false
        },
        "isAD" : {
          "type" : "boolean"
        },
        "name" : {
          "type" : "text",
          "analyzer" : "ik_max_word"
        },
        "price" : {
          "type" : "integer"
        },
        "sold" : {
          "type" : "integer"
        },
        "stock" : {
          "type" : "integer"
        },
        "updateTime" : {
          "type" : "date"
        }
      }
    },
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "1",
        "provided_name" : "items",
        "creation_date" : "1741931912423",
        "number_of_replicas" : "1",
        "uuid" : "CPPRtwVTTrisJk_YeD0AiQ",
        "version" : {
          "created" : "7130199"
        }
      }
    }
  }
}

相关文章

网友评论

      本文标题:ElasticSearch创建索引库文档items

      本文链接:https://www.haomeiwen.com/subject/qdnvmjtx.html