elasticsearch - How to use absolute field names in query_string search with 'fields'? -


i have multiple indices , have search performed globally through these indices.

how can tell elasticsearch differentiate field article.author.name (where 'article' type, , 'author.name' nested field) author.name (where 'author' type , 'name' top-level attribute)?

so, example, if perform such search:

curl -x 'http://localhost:9200/*/author,article/_search?pretty' -d '{   "query": {     "filtered": {       "filter": {         "bool": {           "must": [             {               "term": {                 "tag": "programming"               }             }           ]         }       },       "query": {         "query_string": {           "query": "john doe",           "fields": ["author.name"]         }       }     }   } 

i want search through name field inside author type. not inside author.name field in article type. how can make field names in query considered "absolute" field names? because, given it's global search, want define scope of search fields being queried.

i can't remove article string query uri in case.

you can use should instead of must on bool query string.

curl -x 'http://localhost:9200/*/author,article/_search?pretty' -d '{   "query": {     "filtered": {       "filter": {         "bool": {           "must": [             {               "term": {                 "tag": "programming"               }             }           ]         }       },       "query": {         "bool": {           "must": [                 {                   "term": {                     "author.name": "john doe"                   }                 }           ]         }       }     }   } }' 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -