查看记录

查看单条记录,代码如下:

# encoding:utf-8
#!/usr/bin/python

from elasticsearch import Elasticsearch

class ElasticObj:
    def __init__(self, index_name, index_type, ip ="127.0.0.1"):

        '''
        :param index_name: 索引名称
        :param index_type: 索引类型
        '''
        self.index_name =index_name
        self.index_type = index_type

        # 无用户名密码状态
        self.es = Elasticsearch([ip])

        #用户名密码状态
        # self.es = Elasticsearch([ip],http_auth=('elastic', 'password'),port=9200)

    '''
    查看单条记录
    '''
    def Get_Data_By_Id(self, id):
        print  self.es.get(index=self.index_name, doc_type=self.index_type, id=id)

if __name__ == "__main__":

    obj =ElasticObj("test", "test_type", ip ="127.0.0.1")
    obj.Get_Data_By_Id(1)

执行结果:

{u'_type': u'test_type', u'_source': {u'url': u'https://www.codercto.com/courses/d/61.html', u'id': 1, u'title': u'Eloquent: \u5165\u95e8'}, u'_index': u'test', u'_version': 1, u'found': True, u'_id': u'1'}

点击查看所有 Python 操作 ElasticSearch 简明教程 文章: https://codercto.com/courses/l/6.html

查看所有标签

矩阵论

矩阵论

方保镕 / 清华大学出版社 / 2004-1 / 39.00元

本书比较全面、系统地介绍了矩阵的基本理论、方法及其应用。全书分上、下两篇,共10章,分别介绍了线性空间与线性算子,内积空间与等积变换,λ矩陈与若尔当标准形,赋范线性空间与矩阵范数,矩阵的微积分运算及其应用,广义逆矩阵及其应用,矩阵的分解,矩阵的克罗内克积、阿达马积与反积,几类特殊矩阵(如:非负矩阵与正矩阵、循环矩阵与素矩阵、随机矩阵和双随机矩阵、单调矩阵、M矩阵与H矩阵、T矩阵与汉大象尔矩阵等),......一起来看看 《矩阵论》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

SHA 加密
SHA 加密

SHA 加密工具