Updated examples
This commit is contained in:
@ -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'))
|
||||
|
||||
@ -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'))
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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'))
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -64,7 +64,7 @@ async function run2 () {
|
||||
)
|
||||
const { body } = await client.search({
|
||||
index: 'git',
|
||||
body: new F()
|
||||
body: F()
|
||||
.matchAll()
|
||||
.size(0)
|
||||
.aggs(committersAgg)
|
||||
|
||||
@ -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)
|
||||
|
||||
Reference in New Issue
Block a user