curl -XPOST 'http://localhost:9200/test' -d '{ "settings": { "index": { "mapping.allow_type_wrapper": true } } }' > {"ok":true,"acknowledged":true}
curl -XPUT 'http://localhost:9200/test/barley/_mapping' -d '{ "barley" : { "properties" : { "place" : {"type" : "string", "index" : "not_analyzed"}, "ha" : {"type" : "integer"}, "kg" : {"type" : "integer"}, "t" : {"type" : "integer"} } } }' > {"ok":true,"acknowledged":true}
curl -X PUT http://localhost:9200/test/barley/1 -d '{ "barley" : { "place":"北海道", "ha":1990, "kg":337, "t":6710} } }' > {"ok":true,"_index":"test","_type":"barley","_id":"1","_version":1}
curl -X GET http://localhost:9200/test/barley/_search -d ' { "query": { "match" : {"place" : "北海道"} } }' >{ > "_shards": { > "failed": 0, > "successful": 5, > "total": 5 > }, > "hits": { > "hits": [ > { > "_id": "1", > "_index": "test", > "_score": 0.30685282, > "_source": { > "barley": { > "ha": 1990, > "kg": 337, > "place": "北海道", > "t": 6710 > } > }, > "_type": "barley" > } > ], > "max_score": 0.30685282, > "total": 1 > }, > "timed_out": false, > "took": 114 >}
. ├── scripts │ ├── d3.v3.js │ ├── elasticsearch.js │ ├── main.js │ └── require.js └── test.html
. ├── scripts │ ├── d3.v3.js : wget http://d3js.org/d3.v3.min.js │ ├── elasticsearch.js : wget https://download.elasticsearch.org/elasticsearch/elasticsearch-js/elasticsearch-js-1.5.10.zip │ ├── main.js │ └── require.js : wget http://requirejs.org/docs/release/2.1.11/minified/require.js └── test.html
<!DOCTYPE> <html> <head> <script data-main="scripts/main" src="scripts/require.js"></script> <script>require(["main"], function () {})</script> </head> <body> </body> </html>
You can see the result when you access to the test.html with browser.define(['d3.v3', 'elasticsearch'], function (d3, elasticsearch) { "use strict"; var client = new elasticsearch.Client({hosts:'sample.com:9200'}); client.search({ index: 'test', size: 1, body: { query: { bool: { must: { match: { "place": "北海道" }}, } } } }).then(function (resp) { console.log(resp); console.log(resp.hits.hits[0]._source.barley); }); });
Streamlit is a …
I bought M5Stac…