I have devloped a component that translate expression to esdel, now i have an exp like that
"((extras.key== ‘k1’ and extras.value==100 ) or (extras.key== “k2” and extras.value==”v2”))", in that, ”extras“ is a nested field
we have tow strategies to do that:
- the whole is bool query,
bool(or)
-- nested bool(and)
-- nested bool(and) - the whole is nested query
nested- bool (or)
-- bool (and)
-- bool (and)
- bool (or)
{
"query": {
"bool": {
"should": [
{
"nested": {
"path": "extras",
"query": {
"bool": {
"must": [
{
"term": {
"extras.key": "k1"
}
},
{
"term": {
"extras.value": 100
}
}
]
}
}
}
},
{
"nested": {
"path": "extras",
"query": {
"bool": {
"must": [
{
"term": {
"extras.key": "k2"
}
},
{
"term": {
"extras.value": "v2"
}
}
]
}
}
}
}
]
}
}
}
{
"query": {
"nested": {
"path": "extras",
"query": {
"bool": {
"should": [
{
"bool": {
"must": [
{
"term": {
"extras.key": "k1"
}
},
{
"term": {
"extras.value": 100
}
}
]
}
},
{
"bool": {
"must": [
{
"term": {
"extras.key": "k2"
}
},
{
"term": {
"extras.value": "v2"
}
}
]
}
}
]
}
}
}
}
}
i have run them in head , the same returned
what is the diffirent about the tow in performance or they are the same one?