Last active
August 29, 2015 14:07
-
-
Save shoteff/20fa2411ede09068ce95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Works as expected because of "lenient : true" | |
{ | |
"query": | |
{ | |
"bool": | |
{ | |
"should": | |
[ | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"id", | |
"title" | |
], | |
"default_operator": "and", | |
"lenient": true | |
} | |
} | |
] | |
} | |
} | |
} | |
------------------------------------------------------------------ | |
No results found, no errors - searching in non-existing fields | |
{ | |
"query": | |
{ | |
"bool": | |
{ | |
"should": | |
[ | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"id.nonexisting", | |
"title.nonexisting" | |
], | |
"default_operator": "and" | |
} | |
} | |
] | |
} | |
} | |
} | |
-----------------------Possible bug here---------------------------- | |
If I combine both queries it doesn't work - no errors, but no results (wrong as I have "should" clause, | |
"minimum_should_match" is 1 by default, and the 1st query should yeld results) | |
{ | |
"query": | |
{ | |
"bool": | |
{ | |
"should": | |
[ | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"id", | |
"title" | |
], | |
"default_operator": "and", | |
"lenient": true | |
} | |
}, | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"id.nonexisting", | |
"title.nonexisting" | |
], | |
"default_operator": "and" | |
} | |
} | |
] | |
} | |
} | |
} | |
------------------------------------------------------------------ | |
I'm only removing the integer "id" field from the first subquery and it works | |
{ | |
"query": | |
{ | |
"bool": | |
{ | |
"should": | |
[ | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"title" | |
], | |
"default_operator": "and", | |
"lenient": true | |
} | |
}, | |
{ | |
"simple_query_string": | |
{ | |
"query": "this", | |
"fields": | |
[ | |
"id.nonexisting", | |
"title.nonexisting" | |
], | |
"default_operator": "and" | |
} | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment