Skip to content

Commit 3f2aef9

Browse files
committed
add all the files
0 parents  commit 3f2aef9

File tree

5 files changed

+697
-0
lines changed

5 files changed

+697
-0
lines changed

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[<img src="https://cdn.anychart.com/images/logo-transparent-segoe.png?2" width="234px" alt="AnyChart - Robust JavaScript/HTML5 Chart library for any project">](https://www.anychart.com)
2+
# AnyChart Elasticsearch Integration
3+
This example shows how to use Anychart library with the search and analytics engine Ealsticsearch.
4+
5+
## Running
6+
7+
To use this sample you need to have Elasticsearch installed. If you don’t have it, please, visit the [Elastic download page](https://www.elastic.co/start) or install it with WGET utility using this install guide. You should have JDK 6 or above, and NPM - package manager for Node.js.
8+
9+
To run Elasticsearch server and check its status, execute the following command in Elasticsearch installed folder:
10+
```
11+
bin/elasticsearch
12+
```
13+
or this one on Windows:
14+
```
15+
bin\elasticsearch.bat
16+
```
17+
Elasticsearch is now running. You can access it at http://localhost:9200 in your web browser or get info with CURL:
18+
```
19+
curl http://localhost:9200/
20+
```
21+
22+
**To start this example run the commands listed below.**
23+
24+
Clone the repository from github.com:
25+
```
26+
git clone [email protected]:anychart-integrations/elasticsearch-template.git
27+
```
28+
29+
Navigate to the repository folder:
30+
```
31+
cd elasticsearch-template
32+
```
33+
34+
Install dependencies:
35+
```
36+
npm install
37+
```
38+
39+
Put some test data to the Elasticsearch instance where 'testbase' is intended for an index, 'dataset' is for a type and '1' is for an id:
40+
```
41+
curl -XPOST -H'Content-Type: application/json' http://localhost:9200/testbase/dataset/1 -d '{"data":[{"x":"Apples", "value": "128"},{"x":"Oranges", "value": "99"},{"x":"Lemons", "value": "54"},{"x":"Bananas", "value": "150"}] }'
42+
```
43+
44+
Run the sample:
45+
```
46+
npm start
47+
```
48+
49+
Now open browser at http://localhost:8080/
50+
51+
## Useful commands
52+
While Elasticsearch is running you may use commands to:
53+
54+
1. Get the current mapping of index 'testbase':
55+
```
56+
curl -XGET -H'Content-Type: application/json' "http://localhost:9200/testbase/_mapping?pretty"
57+
```
58+
59+
2. Get the document from index 'testbase' with the type 'dataset' and id '1':
60+
```
61+
curl -XGET "http://localhost:9200/testbase/dataset/1?pretty"
62+
```
63+
64+
3. Delete existing index 'testbase' from the Elasticsearch instance:
65+
```
66+
curl -XDELETE http://localhost:9200/testbase
67+
```
68+
69+
## Technologies
70+
Search engine - [Elasticsearch](https://www.elastic.co/products/elasticsearch/)<br />
71+
72+
73+
## Further Learning
74+
* [Documentation](https://docs.anychart.com)
75+
* [JavaScript API Reference](https://api.anychart.com)
76+
* [Code Playground](https://playground.anychart.com)
77+
* [Technical Support](https://www.anychart.com/support)
78+
79+
80+
## License
81+
AnyChart Elasticksearch integration sample includes two parts:
82+
- Code of the integration sample that allows to use Javascript library (in this case, AnyChart) with Elastichsearch engine. You can use, edit, modify it, use it with other Javascript libraries without any restrictions. It is released under [Apache 2.0 License](https://github.com/anychart-integrations/python-django-mysql-template/blob/master/LICENSE).
83+
- AnyChart JavaScript library. It is released under Commercial license. You can test this plugin with the trial version of AnyChart. Our trial version is not limited by time and doesn't contain any feature limitations. Check details [here](https://www.anychart.com/buy/).
84+
85+
If you have any questions regarding licensing - please contact us. <[email protected]>
86+
87+
[![Analytics](https://ga-beacon.appspot.com/UA-228820-4/Integrations/elasticsearch-template?pixel&useReferer)](https://github.com/igrigorik/ga-beacon)

index.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
5+
<meta name="author" content="AnyChart">
6+
<!--AnyChart modules-->
7+
<script src="https://cdn.anychart.com/releases/v8/js/anychart-bundle.min.js"></script>
8+
<style>
9+
html, body, #container {
10+
width: 100%;
11+
height: 100%;
12+
margin: 0;
13+
padding: 0;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<div id="container"></div>
19+
<script>
20+
anychart.onDocumentReady(function () {
21+
// {{data}} token is replaced by the server with the site data during the page rendering
22+
var data = '{{data}}';
23+
24+
// create a chart and set the data
25+
var chart = anychart.pie(data);
26+
27+
// set the chart title
28+
chart.title("Pie Chart: data loaded with ElasticSearch");
29+
30+
// set the container id and initiate drawing the chart
31+
chart.container("container").draw();
32+
});
33+
</script>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)