Here is my request
POST indexName/test/_search
{
"fields" : ["Col1"],
"query":{
"filtered":{
"query":{
"wildcard": {
"Col1": {
"value": "*zxc*"
}
}
},
"filter":
{
"term": {
"Col2": "val"
}
}
}
}
}
so I want to do a wildcard on Col1for the value *zxc*, and I need only those values where Col2 valit returns 0 hits. Is there something wrong with my syntax?
The wildcard query works independently if I remove the filter.
Edit
it works
POST indexName/test/_search
{
"fields" : ["Col1"],
"query":{
"filtered":{
"filter":
{
"term": {
"Col2": "val"
}
}
}
}
}
sample document returned
{
"_index": "indexName",
"_type": "test",
"_id": "oainfubgvwurebetrnjt",
"_score": 1,
"fields": {
"Col1": [
"uyiwebvybg iuowenbgubnrwev uirbgvuire3bv vuirbg"
]
}
}
and it does
POST indexName/test/_search
{
"fields" : ["Col1"],
"query":{
"wildcard": {
"Col1": {
"value": "*zxc*"
}
}
}
}
sample document returned
{
"_index": "indexName",
"_type": "test",
"_id": "aofnhuiwegbnweu",
"_score": 1,
"fields": {
"Col1": [
"idasihid huwbgbuiwb iuohfuweb zxc oifjhwgbu"
]
}
}
therefore, both of these queries work independently. How to combine them?
Edit
Here's what a typical answer looks like with both fields
{ "_index": "indexName", "_type": "test", "_id": "aofnhuiwegbnweu", "_score": 1, "": { "Col1": [ "idasihid huwbgbuiwb iuohfuweb zxc oifjhwgbu" ],
"Col2": [
"asd"
]
}
}
POST indexName/test/_search
{
"fields" : ["Col1","Col2"],
"query":{
"wildcard": {
"Col1": {
"value": "*zxc*"
}
}
}
}