I'm trying to understand some inconsistencies in search results. I'm attempting give all the necessary details. This post looks long (my apologies) due to JSON content. First the mapping:
{
"_all":{
"enabled":false
},
"properties":{
"edgeCount":{
"type":"long"
},
"nodeCount":{
"type":"long"
},
"degree":{
"type":"nested",
"properties":{
"size":{
"type":"long"
},
"count":{
"type":"long"
}
}
},
"sequence":{
"type":"nested",
"properties":{
"size":{
"type":"long"
},
"count":{
"type":"long"
}
}
},
"cycle":{
"type":"nested",
"properties":{
"size":{
"type":"long"
},
"count":{
"type":"long"
}
}
}
}
}
The document
{
"nodeCount":3,
"edgeCount":2,
"degree":[
{
"size":1,
"count":2
},
{
"size":2,
"count":1
}
],
"sequence":[
{
"size":3,
"count":1
}
]
}
The query below fails to match the above document. What's wrong here? If I remove one of the conditions in the nested degree conditions ({"term":{"degree.size":2}},{"term":{"degree.count":1}
) it works.
{
"query":{
"bool":{
"must":[
{
"term":{
"edgeCount":2
}
},
{
"term":{
"nodeCount":3
}
},
{
"nested":{
"path":"sequence",
"query":{
"bool":{
"must":[
{
"term":{
"sequence.size":3
}
},
{
"term":{
"sequence.count":1
}
}
]
}
}
}
},
{
"nested":{
"path":"degree",
"query":{
"bool":{
"must":[
{
"term":{
"degree.size":1
}
},
{
"term":{
"degree.count":2
}
},
{
"term":{
"degree.size":2
}
},
{
"term":{
"degree.count":1
}
}
]
}
}
}
}
]
}
}
}
The query actually works for document with edgeCount 3 and nodeCount 4.
Any insight? Thanks in advance.