elasticsearch


Elasticsearch Painless script get nested field by value?


I want to compute the score of my query on elasticsearch based on a nested field value. Here is an example of my document:
{
"title": "Mr",
"first_name": "Barry",
"last_name": "White",
"experiences": [
{
"name": "parachute",
"values": {
"last_year": 4,
"older": 12
}
},
{
"name": "base jump",
"values": {
"last_year": 2,
"older": 1
}
}
]
}
What I want is filter and rank a query according to number of experiences and range (last year values are more important). The problem is: how can I get the value of filtered experience?
here is a simplified version of my query:
{
"query" :{
"nested": {
"path": "experiences",
"query":{
"function_score" : {
"functions": [
{
"filter": {"term": { "experiences.name": "parachute"} },
"script_score" : {
"script" : {
"lang": "painless",
"inline": "_score * doc['experiences.values.older'].value" //Here I want to get the "older" value of "parachute": 12
}
}
}
]
}
}
}
}
}
Hope there's a way to solved this...
Thanks in advance for your help

Related Links

Elasticsearch Stemmer Override Token Filter not working when usind rules path
Logstash extracting values from sp_executesql
Logstash Grok Modifying and overwriting #timestamp
how to restore elasticsearch.yml config file to original?
Index a graph with ElasticSearch
ElasticSearch query not returning expected results
Fluentd High Availability Custom Index
How do I add an attribute to an Elasticsearch node for the purpose of Shard Allocation Filtering?
Configure ElasticSearch attachment mapper to use OCR plugin
ElasticSearch: How to search for a value in any field, across all types, in one or more indices?
Phrase suggestor - which index and query to act upon
Adding additional fields to ElasticSearch terms aggregation
ElasticSearch multi_match if field exists apply filter otherwise dont worry about it?
ElasticSearch Date Histogram Interval
Kibana 4 index patterns time-field
elasticsearch: Did I lose data when two of my three nodes went down?

Categories

HOME
flask
class
focus
eclipse-plugin
barcode-scanner
enums
whmcs
histogram
dronekit-python
fogbugz
elk-stack
scheduler
tfs2010
swarm
match
chromecast
ex
heap-dump
nest-api
c#-7.0
rpmbuild
maven-plugin
restier
managed-c++
crud
android-service
ccavenue
unmarshalling
steam-web-api
delayed-job
series
sca
android-collapsingtoolbar
listjs
apptentive
cups
linq.js
assemblies
game-center
suds
grails-spring-security
newtons-method
coverage.py
fiware-wirecloud
qvtkwidget
autorelease
webalizer
deployd
winston
portability
controllers
multi-touch
jsf-2.3
tsqlt
gcloud-node
mathml
jtag
adjacency-list
django-redis
accessibilityservice
vim-plugin
wikimedia-commons
juniper-network-connect
google-maps-api-2
dnx50
auto-generate
ngcordova
roxygen2
ampersand
innerhtml
camus
signed
createfile
smacss
window-resize
relationships
visual-c++-2012
code-complexity
bittorrent-sync
spring-social-linkedin
nosql-aggregation
pbkdf2
compiler-flags
non-ascii-characters
libxml-js
bcdedit
statechart
red-system
semantic-merge
spark-view-engine
struts2-json-plugin
zend-pdf
sfinae
coordinate
infopath-2007
firefly-mv
database-deadlocks
rtd
uninstaller
reliability
iphone-sdk-4.3
google-translator-toolkit
fuzzy-comparison
rakudo

Resources

Encrypt Message