Platform
Resources
Pricing
Sign in
Get started
bnewbold
Canonical git location: https://git.bnewbold.net
Workspace
Fork
Published
By
bnewbold
Edited
Aug 26, 2020
2 stars
Insert cell
Insert cell
//es = require('https://bundle.run/@elastic/elasticsearch@7.5.0')
es
=
require
(
'https://bundle.run/elasticsearch@16.6.0'
)
;
Insert cell
// NOTE: https://search.fatcat.wiki should work soon. search.qa.fatcat.wiki currently points to the same back-end index
client
=
new
es
.
Client
(
{
host
:
'https://search.qa.fatcat.wiki'
}
)
Insert cell
client
.
ping
(
)
Insert cell
client
.
count
(
{
index
:
'fatcat_release'
,
body
:
{
query
:
{
query_string
:
{
query
:
'blood'
,
}
}
}
}
)
Insert cell
resp
=
client
.
search
(
{
index
:
'fatcat_release'
,
size
:
0
,
body
:
{
query
:
{
bool
:
{
must
:
{
term
:
{
preservation
:
'bright'
}
}
,
filter
:
{
range
:
{
year
:
{
gte
:
1945
,
lte
:
2019
}
}
}
}
}
,
aggs
:
{
by_year
:
{
histogram
:
{
field
:
"year"
,
interval
:
1
}
}
}
}
}
)
Insert cell
df
=
resp
.
aggregations
.
by_year
.
buckets
Insert cell
import
{
vl
}
from
'@vega/vega-lite-api'
Insert cell
vl
.
markBar
(
)
.
data
(
df
)
.
encode
(
vl
.
y
(
)
.
fieldQ
(
'doc_count'
)
,
vl
.
x
(
)
.
fieldQ
(
'key'
)
)
.
render
(
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
es
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
client
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
resp
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
df
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML