【发布时间】:2016-02-18 22:57:21
【问题描述】:
我想使用 elasticsearch-dsl 0.0.9 库,但是他们的示例已经过时了。 我安装了最新版本,Integer 和 Boolean 类型不再存在。
因此他们的例子不起作用。
from datetime import datetime
#There is no 'Integer' in elasticsearch_dsl
from elasticsearch_dsl import DocType, String, Date, Integer
from elasticsearch_dsl.connections import connections
# Define a default Elasticsearch client
connections.create_connection(hosts=['localhost'])
class Article(DocType):
title = String(analyzer='snowball', fields={'raw': String(index='not_analyzed')})
body = String(analyzer='snowball')
tags = String(index='not_analyzed')
published_from = Date()
lines = Integer() ############################## HERE
有人知道如何声明整数字段吗?
谢谢。
编辑
根据本文档https://media.readthedocs.org/pdf/elasticsearch-dsl/latest/elasticsearch-dsl.pdf,整数类型在 0.0.9 中仍应可用
不知道为什么找不到。
从我的 pip 输出中可以看出,我确实安装了 0.0.9:Downloading elasticsearch_dsl-0.0.9-py2.py3-none-any.whl
【问题讨论】:
标签: python-2.7 elasticsearch elasticsearch-dsl