elasticsearch


how to use two parallel Aggregation for elasticsearch nest


Like bellow http request:
base on TERM "service_project" aggr, there are 2 another SUM aggr "service_hour_price" and "servic_part_price". Can I use Elasticsearch Nest do the same thing?
"aggs": {
"3": {
"terms": {
"field": "service_project",
"size": 50,
"order": {
"1": "desc"
}
},
"aggs": {
"1": {
"sum": {
"field": "service_hour_price"
}
},
"2": {
"sum": {
"field": "servic_part_price"
}
}
}
}
}
Now I can use only one SUM Aggr base on That Term Aggr, like this:
return s.Aggregations(a => a
.Terms("names", st => st
.Field(o => o.service_project)
.OrderDescending("sum")
.Size(term_count)
.Aggregations(aa => aa
.Sum("sum", m => m
.Field(o => o.service_hour_price)))));
You are almost there:
s.Aggregations(a => a
.Terms("3", t => t
.Field("service_project")
.Size(50)
.OrderDescending("1")
.Aggregations(aa => aa
.Sum("1", sum => sum.Field("service_hour_price"))
.Sum("2", sum => sum.Field("service_part_price")))
));
Hope it helps.

Related Links

ElasticSearch has_child query does not support query_string
elastic search autocomplete, searching with space creating an issue
(ELK) logstash grok for SBR accounting log
aws cloudsearch/lucene query street names
Getting cardinality of multiple fields?
Aggregating a Key/Value list in ElasticSearch
“reverse cardinality” in elasticsearch?
ElasticSearch- Using Fields doesn't return any documents on Nest
Analyzer to find , e.g: “starbucks” when mistakenly querying “star bucks”
Elasticsearch - boost document based on field's specific value
How to get elasticsearch most used words?
Umlaut in Elastic Suggesters
Index creation move elastic search cluster to red
Is there multiword synonyms with slop in ES
Elasticsearch: How do you delete a mapping type without deleting an entire index?
What are the performance drawbacks of flat documents vs. nested ones?

Categories

HOME
python-2.7
rust
mc
list
opencart
mpdf
shinyapps
key
swi-prolog
activemq
plpgsql
initialization
typeerror
openfoam
kurento
cocotb
hystrix
graphdb
feature-extraction
max-msp-jitter
async-await
phonegap-build
pywinauto
fosuserbundle
google-sites
psql
raml
angular2-highcharts
fluent-migrator
tortoisemerge
oracleforms
sfml
bitbake
jsonresult
rspec-rails
custom-keyboard
directfb
spinner
xvfb
django-smart-selects
uipickerview
flipkart
word-cloud
notesview
web-inspector
deployd
django-static-precompiler
icecast
sigsegv
android-sharing
boost-compute
elastic4s
controllers
bigdecimal
nclam
msg
wininet
raw-sockets
coovachilli
apple-configurator
utf-16
diawi
odesk
json-spirit
ibm-was
mixins
gitlab-omnibus
search-form
ipod
incron
baseadapter
dnsjava
utf8-decode
image-rotation
webautomation
nachos
incognito-mode
reference-counting
property-injection
armv6
mute
notifyjs
django-facebook
hints
pacman
bcdedit
chartfx
donut-chart
smartfox
image-scanner
series-40
opends
upshot
zend-test
browser-based
ntruencrypt
tso
html-generation
rootkit

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile