elasticsearch


Elasticsearch Partial Fields With Inner Hits


Is it possible to use the partial_fields parameter when performing a nested filter/query ?
For example this query will return just the fields I am looking for from the hits:
{
"query": {
"filtered": {
"query": {
"ids": {
"type": "users",
"values": [
"111"
]
}
},
"filter": {
"nested": {
"path": "entitlements",
"filter": {
"bool": {
"must": [
{
"term": {
"program": "program-a"
}
}
]
}
},
"inner_hits": {
"size": 999
}
}
}
}
},
"partial_fields": {
"partial": {
"include": [
"entitlements.accountNumber",
"entitlements.name",
"entitlments.numbers"
]
}
}
}
However the inner_hits section, no fields are returned.
"inner_hits": {
"entitlements": {
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "myGreatIndex",
"_type": "users",
"_id": "111",
"_nested": {
"field": "entitlements",
"offset": 0
},
"_score": 1,
"fields": {
"partial": [
{}
]
}
}
]
}
}
}
Is there a way to apply this for inner_hits ?
Inside the inner_hits section, you may use source filtering instead. partial_fields will work for outer hits and _source for inner_hits.
So you can specify your inner_hits like this:
"inner_hits": {
"size": 999,
"_source": [
"accountNumber",
"name",
"numbers"
]
}
Note, though, that within your inner_hits results, you'll still get an empty partial array, but the fields you need will show up within the _source section.
Also worth noting that if you specify your partial_fields with unqualified names (see below), then partial fields will show up in your inner_hits results, but not in the outer hits anymore. So you need to figure out which works best for you.
"partial_fields": {
"partial": {
"include": [
"accountNumber",
"name",
"numbers"
]
}
}

Related Links

Elastica - multiple bool queries - subqueries
How do i add boosting to the elasticsearch mapping in ONGR?
Is it possible to use doc_count as a term in elasticsearch?
Elastic search aggregation with sort
Elasticsearhc- how to do multi search request on Sense or Head plugin
How do I configure/initialize a custom Elasticsearch Tokenizer
Combining log entries with logstash
How to import CSV data using Logstash for field type completion in Elasticsearch suggester
How can I interpret the result of percentiles aggregation type
elastic search select fields to return in aggregation
How to Focus Search On One Part of a Document
How to calculate cooccurrences on a set of texts with Elasticsearch
elasticsearch edge_ngrams analyzer is not found
Double wildcard in query causes weird highlighting for plain/fast vectors elasticsearch highlighters
Get Elasticsearch response in DataTable in C#.Net
Elasticsearch NoNodeAvailableException issue

Categories

HOME
openshift
webview
keyboard
functional-programming
windows-8.1
transactions
subdomain
dafny
vsts-build
celery
twitter-fabric
cryptography
mithril.js
angular2-template
eddystone
reportviewer
parsley.js
fbloginview
fullcalendar-scheduler
checkout
susy-sass
substring
function-points
ipa
multi-dimensional-scaling
annotation-processing
macromedia
php-5.3
mdns
splunk-query
docx4j
autodesk-model-derivative
windowsiot
john-the-ripper
android-n
google-now
grails3.2.0
axis
photoswipe
uiautomatorviewer
lightning-workbench
visual-format-language
datediff
glassfish-4.1
emacs25
zend-server
email-injection
jsonix
conan
node-glob
maximize
distributed-cache
odesk
perceptron
mixins
netdatacontractserializer
knife
wso2ml
blockquote
postal-code
domino-designer-eclipse
bootstrap-wysiwyg
physicsjs
mathematical-expressions
uno
thoughtworks-go
ildasm
cout
box2dweb
maven-central
hotswap
proxy-server
pbkdf2
hyphen
frontbase
non-ascii-characters
virtual-channel
tnt4j
node.js-stream
microformats
flv
spiral
cakeyframeanimation
autosize
cewolf
digiflow
git-log
hungarian-notation
dm
gtktextview
xap
datagridcolumn
chronic
synthesizer

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile