ruby on rails - ElasticSearch - Search Nested Associations with Multi Match -


i having issues searching nested fields multi_match. following represents database structure:

normalbrands has_many => normalmodels has_many => products 

i've run index on products , included parent , grandparent associations nested document types.

here mapping:

curl -xget 'localhost:9200/products/_mapping/product?pretty' {   "products" : {     "mappings" : {       "product" : {         "dynamic" : "false",         "properties" : {           "name" : {             "type" : "text",             "analyzer" : "synonym"           },           "normal_model" : {             "type" : "nested",             "properties" : {               "machine_type" : {                 "type" : "text",                 "analyzer" : "english"               },               "name" : {                 "type" : "text",                 "analyzer" : "synonym"               },               "normal_brand" : {                 "type" : "nested",                 "properties" : {                   "name" : {                     "type" : "text",                     "analyzer" : "synonym"                   }                 }               },               "number" : {                 "type" : "text",                 "analyzer" : "english"               }             }           },           "part_number" : {             "type" : "text",             "analyzer" : "english"           },           "status" : {             "type" : "text",             "analyzer" : "english"           },           "text" : {             "type" : "text",             "analyzer" : "english"           }         }       }     }   } } 

from best can tell, appears multi_match not searching normal_model.name or normal_brand.name. here search query.

"query": {     "multi_match" : {       "query":    "nordictrack",        "fields": [ "name", "normal_model.name", "normal_brand.name" ]      } } 

this query returns 0 results. however, if use query_string, search works expected. however, need features of multi_match. if please appreciated. thanks

update:

i've tried couple of things since last posted question. if set 1 of fields in multi_match "_all", search results return results matches in normal_model.name , normal_brand.name fields. i've added updated query below. however, still think wrong because shouldn't have reference "_all" field work should i?

"query": {     "multi_match" : {       "query":    "nordictrack",        "fields": [ "name", "normal_model.name", "normal_brand.name", "_all"]      } } 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -