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 theory behind query compilation is the same here,
|
||||||
// the query crafting and compilation should be done
|
// the query crafting and compilation should be done
|
||||||
// outside of your hot code path.
|
// outside of your hot code path.
|
||||||
const query = new F()
|
const query = F()
|
||||||
.match('description', Q.param('description'))
|
.match('description', Q.param('description'))
|
||||||
.filter(f => f
|
.filter(f => f
|
||||||
.term('author.name', Q.param('author'))
|
.term('author.name', Q.param('author'))
|
||||||
|
|||||||
@ -88,7 +88,7 @@ import { Q, F } from '../'
|
|||||||
// The theory behind query compilation is the same here,
|
// The theory behind query compilation is the same here,
|
||||||
// the query crafting and compilation should be done
|
// the query crafting and compilation should be done
|
||||||
// outside of your hot code path.
|
// outside of your hot code path.
|
||||||
const query = new F()
|
const query = F()
|
||||||
.match('description', Q.param('description'))
|
.match('description', Q.param('description'))
|
||||||
.filter(f => f
|
.filter(f => f
|
||||||
.term('author.name', Q.param('author'))
|
.term('author.name', Q.param('author'))
|
||||||
|
|||||||
@ -53,7 +53,7 @@ async function run2 () {
|
|||||||
// get the day where the most commits were made
|
// get the day where the most commits were made
|
||||||
const { body } = await client.search({
|
const { body } = await client.search({
|
||||||
index: 'git',
|
index: 'git',
|
||||||
body: new F()
|
body: F()
|
||||||
.size(0)
|
.size(0)
|
||||||
// 'day_most_commits' is the name of the aggregation
|
// 'day_most_commits' is the name of the aggregation
|
||||||
.aggs(
|
.aggs(
|
||||||
|
|||||||
@ -49,7 +49,7 @@ async function run2 () {
|
|||||||
// search commits that contains 'fix' but do not changes test files
|
// search commits that contains 'fix' but do not changes test files
|
||||||
const { body } = await client.search({
|
const { body } = await client.search({
|
||||||
index: 'git',
|
index: 'git',
|
||||||
body: new F()
|
body: F()
|
||||||
// You can avoid to call `.must`, as any query will be
|
// You can avoid to call `.must`, as any query will be
|
||||||
// sent inside a `must` block unless specified otherwise
|
// sent inside a `must` block unless specified otherwise
|
||||||
.must(f => f.match('description', 'fix'))
|
.must(f => f.match('description', 'fix'))
|
||||||
|
|||||||
@ -48,7 +48,7 @@ async function run2 () {
|
|||||||
// last 10 commits for 'elasticsearch-js' repo
|
// last 10 commits for 'elasticsearch-js' repo
|
||||||
const { body } = await client.search({
|
const { body } = await client.search({
|
||||||
index: 'git',
|
index: 'git',
|
||||||
body: new F()
|
body: F()
|
||||||
.term('repository', 'elasticsearch-js')
|
.term('repository', 'elasticsearch-js')
|
||||||
.sort('committed_date', { order: 'desc' })
|
.sort('committed_date', { order: 'desc' })
|
||||||
.size(10)
|
.size(10)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ async function run2 () {
|
|||||||
)
|
)
|
||||||
const { body } = await client.search({
|
const { body } = await client.search({
|
||||||
index: 'git',
|
index: 'git',
|
||||||
body: new F()
|
body: F()
|
||||||
.matchAll()
|
.matchAll()
|
||||||
.size(0)
|
.size(0)
|
||||||
.aggs(committersAgg)
|
.aggs(committersAgg)
|
||||||
|
|||||||
@ -91,7 +91,7 @@ async function run2 () {
|
|||||||
|
|
||||||
const { body: topMonths } = await client.search({
|
const { body: topMonths } = await client.search({
|
||||||
index: 'git',
|
index: 'git',
|
||||||
body: new F()
|
body: F()
|
||||||
// we want to know the top month for 'delvedor'
|
// we want to know the top month for 'delvedor'
|
||||||
.filter(f => f.term('author', 'delvedor'))
|
.filter(f => f.term('author', 'delvedor'))
|
||||||
.size(0)
|
.size(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user