elasticsearch


elasticsearch terms on bool field not working


I have this query that returns always null :
{
"query": {
"bool": {
"should": {
"nested": {
"query": {
"bool": {
"must": [
{
"term": {
"old": false
}
}
]
}
},
"path": "jobOffers"
}
}
}
}
}
Here's what match all returns :
{
"hits": [{
"_index": "dev",
"_type": "recruitment",
"_id": "202837r",
"_score": 1,
"_routing": "202837",
"_parent": "202837",
"_source": {
"score": 1,
"jobOffers": [{
"jobId": "jksncdjkqsnhcjkqs",
"jobCompany": "company 1",
"jobTitle": "Comptable",
"old": false
}],
"totalCount": 1
}
},
{
"_index": "dev",
"_type": "recruitment",
"_id": "202838r",
"_score": 1,
"_routing": "202838",
"_parent": "202838",
"_source": {
"score": 1,
"jobOffers": [{
"jobId": "wxjkckjwxhcmlazdkklqjkcn",
"jobCompany": "company 2",
"jobTitle": "Commercial",
"old": false
},
{
"jobId": "lxjkckazdwxctrzadjkoo",
"jobCompany": "company 2",
"jobTitle": "Chargé de développement commercial",
"old": false
}
],
"totalCount": 2
},
...
}
I made sure I'am querying the right index and the right type. Is this behavior normal? How can I make it return the expected result?
In your query, you need to write jobOffers.old instead of just old
{
"query": {
"bool": {
"should": {
"nested": {
"query": {
"bool": {
"must": [
{
"term": {
"jobOffers.old": false <--- modify this
}
}
]
}
},
"path": "jobOffers"
}
}
}
}
}

Related Links

Seeing many open Elasticsearch connections even after using singleton pattern
What would be a good approach for sending logs from multiple servers a centralized logging server?
does elasticsearch support queries of queries?
Data modelling with elastic search
match or term query on a long property for exact match?
Updating filtered documents in elasticsearch
Testing ElasticSearch custom analyzers
timestamp issue in elasticsearch
Elasticsearch NEST client singleton usage
Elasticsearch: suggest users based on likes
Set every property type to not_analyzed for custom object
How to tell ElasticSearch to create nested fields
Elasticsearch minimum master nodes
How to create an Elasticsearch index without word-splitting?
Run a simple sql group by query in kibana 4
Clearing ttl from an object in elasticsearch

Categories

HOME
qt
cocoapods
python-2.7
svn
weblogic12c
yaml
eclipse-plugin
yahoo-weather-api
android-fragments
bokeh
concurrency
biztalk
odata
consul
docker-cloud
twitter-fabric
web2py
cypher
amp
drag-and-drop
firebase-database
minecraft
tweepy
cocotb
azure-logic-apps
wine
phpstorm-2017.1
outlook-restapi
playframework-2.0
checkout
data-type-conversion
react-dnd
jstree
tortoisehg
dnsmasq
monitor
tilemill
xenapp
matlab-app-designer
location-services
om-next
bootstrap-sass
buildforge
ftp-server
twilio-php
cloudera-quickstart-vm
reset
angular-datatables
hypothesis-test
dbcc
bit-shift
gcal
entropy
embedded-v8
sequence-diagram
word-2007
nivo-slider
lvalue
ltrace
instafeedjs
d3v4
oid
mifos
xmlbeans
dcount
tsqlt
raw-sockets
dojo-build
unsigned
wif4.5
cortana
azure-xplat-cli
configurable-product
libgcc
code-complexity
hotswap
autonumber
illuminate-container
san
yii-booster
delphi-xe4
reentrancy
icenium
multiscaleimage
multiple-dispatch
struts2-json-plugin
playorm
thejit
asio
firefly-mv
qt-mobility
cleartype
facebook-fbml
accumulator
watchpoint
levels
chronic
bindable-linq

Resources

Encrypt Message