Updated examples

This commit is contained in:
delvedor
2020-09-04 18:04:38 +02:00
parent ecccaf023e
commit b104ce42f5
7 changed files with 7 additions and 7 deletions

View File

@ -88,7 +88,7 @@ import { Q, F } from '../'
// The theory behind query compilation is the same here,
// the query crafting and compilation should be done
// outside of your hot code path.
const query = new F()
const query = F()
.match('description', Q.param('description'))
.filter(f => f
.term('author.name', Q.param('author'))

View File

@ -88,7 +88,7 @@ import { Q, F } from '../'
// The theory behind query compilation is the same here,
// the query crafting and compilation should be done
// outside of your hot code path.
const query = new F()
const query = F()
.match('description', Q.param('description'))
.filter(f => f
.term('author.name', Q.param('author'))

View File

@ -53,7 +53,7 @@ async function run2 () {
// get the day where the most commits were made
const { body } = await client.search({
index: 'git',
body: new F()
body: F()
.size(0)
// 'day_most_commits' is the name of the aggregation
.aggs(

View File

@ -49,7 +49,7 @@ async function run2 () {
// search commits that contains 'fix' but do not changes test files
const { body } = await client.search({
index: 'git',
body: new F()
body: F()
// You can avoid to call `.must`, as any query will be
// sent inside a `must` block unless specified otherwise
.must(f => f.match('description', 'fix'))

View File

@ -48,7 +48,7 @@ async function run2 () {
// last 10 commits for 'elasticsearch-js' repo
const { body } = await client.search({
index: 'git',
body: new F()
body: F()
.term('repository', 'elasticsearch-js')
.sort('committed_date', { order: 'desc' })
.size(10)

View File

@ -64,7 +64,7 @@ async function run2 () {
)
const { body } = await client.search({
index: 'git',
body: new F()
body: F()
.matchAll()
.size(0)
.aggs(committersAgg)

View File

@ -91,7 +91,7 @@ async function run2 () {
const { body: topMonths } = await client.search({
index: 'git',
body: new F()
body: F()
// we want to know the top month for 'delvedor'
.filter(f => f.term('author', 'delvedor'))
.size(0)