我刚开始学习ElasticSearch,我的第一步并不是太糟糕。我在Python上提供的ES库的帮助下输入了一些数据,其中包含以下代码:
ng-show="event.etype == 'ipad'"
但是,当我想定义我放置的每种类型的字段时,ES只是忽略它。我认为我的进展方式并不正确。在执行我的Python脚本之前,我执行了一段代码:
from elasticsearch import Elasticsearch
jsondata(json.dumps("{
"low": "5.9400",
"high": "5.9600",
"id": "555",
"volume": 1171,
"timestamp": "2016-08-15 19:01:03"
}"
)
ES_HOST = {"host" : "localhost", "port" : 9200}
es = Elasticsearch(hosts = [ES_HOST])
es.create(index="index_test",
doc_type="tr",
body=jsondata
)
默认情况下,ES会将所有字段设置为curl -XPUT 'http://localhost:9200/index_test/' -d '"mappings": {
"tr": {
"_source": {
"enabled":true
}
"properties" : {
"id" : { "type" : "integer" },
"volume" : { "type" : "integer" },
"high" : { "type" : "float" },
"low" : { "type" : "float" },
"timestamp" : { "type" : "date", "format" : "yyyy-MM-dd HH:mm:ss" }
}
}
}'
的数据存储,但string
字段除外,设置为volume
。 ES通过Kibana提供了JSON:
number
我忘了什么?也许我需要添加设置部分?
答案 0 :(得分:0)
有它!
好的,我已尝试过以下操作:
Cleaning build folder
所以我忘了在我的路径之前添加@,这就是为什么它不起作用^^":
$curl -XDELETE http://localhost:9200/index_test/
{"acknowledged":true}
$curl -XPUT 'http://localhost:9200/index_test/' -d conf/ESConf/ElasticSearchMapping.conf
{"acknowledged":true}
$curl -XGET 'http://localhost:9200/index_test/'
{"index_test":{"aliases":{},"mappings":{},"settings":{"index": {"conf/ESConf/ElasticSearchMapping":{"conf":""},"creation_date":"1471283566621","number_of_shards":"5","number_of_replicas":"1","uuid":"EZoDAOJNQoiX4VQWs1Sx1w","version":{"created":"2030499"}}},"warmers":{}}}