Elasticsearch 基礎

1.新建索引
localhost:9200/docutone_dtnvdr
{
	"mappings": {
	"properties": {
        "operatingTime": {
          "type":   "date",
           "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
         "operTime": {
          "type":   "date",
           "format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        },
	"operatortype": { 
          "type":     "text",
          "fielddata": true
       }
      }
      }
}

2.導入數據

3.設置檢索字段fielddata
localhost:9200/docutone_dtnvdr/_mapping
{
  "properties": {
    "crateBy": { 
      "type":     "text",
      "fielddata": true
    },
    "operType": { 
      "type":     "text",
      "fielddata": true
    }, "profileId": { 
      "type":     "text",
      "fielddata": true
    },"groupId": { 
      "type":     "text",
      "fielddata": true
    },"operatortype": { 
      "type":     "text",
      "fielddata": true
    }
  }
}


//創建索引使用ik分詞
{
    "mappings": {
        "properties": {
            "docName": {
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_smart"
            },
            "content": {
                "type": "text",
                "analyzer": "ik_max_word",
                "search_analyzer": "ik_smart"
            }
        }
    }
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章