the index definition is this:
  "settings": {
                "index": {
                    "number_of_shards": 7,
                    "number_of_replicas": 1,
                    "analysis": {
                        "analyzer": {
                            "analyzer_raw": {
                                "tokenizer": "keyword",
                                "filter": "lowercase"
                            }
                        }
                    }
                }
            },
            "mappings": {
                "_default_": {
                    "_ttl": {
                        "enabled": 'true',
                        "default": ttl
                    }
                },
                "user_activity_v2": {
                    "_id": {
                        "path": "customer_id"
                    },
                    "properties": {
                        "customer_id": {"type": "long"},
                        "store_purchase": {
                            "type": "nested",
                            "include_in_parent": "true",
                            "properties": {
                                "item_id":    {"type": "string"},
                                "cat": {
                                    "type": "multi_field",
                                    "fields": {
                                        "cat": {
                                            "type": "string",
                                        },
                                        "original": {
                                            "type": "string",
                                            "search_analyzer": 
"analyzer_raw",
                                            "index_analyzer": "analyzer_raw"
                                        }
                                    }
                                }
}

On Tuesday, March 17, 2015 at 5:24:04 PM UTC-7, Chen Wang wrote:
>
> Folks,
> I have defined a nested object with multi_fields attribute: the "cat" in 
> store_purchase
>
>
> I loaded some data into Es:
>  {
>             "_index": "user_activity_v2",
>             "_type": "combined",
>             "_id": "1229369",
>             "_score": 1,
>             "_source": {
>                "store_purchase": [
>                   {
>                      "item_id": "10423846",
>                      "subcat": "First Aid",
>                      "brand_name": "brand name",
>                      "event_time": "2015-03-09",
>                      "cat": "otc"
>                   },
>                   {
>                      "item_id": "34897214",
>                      "subcat": "coffee",
>                      "brand_name": "brand name2",
>                      "event_time": "2015-03-09",
>                      "cat": "cat2 with space"
>                   },
> }
>
> However, I cannot find any data from the following search
>
> GET _search
> {
>   "query": {
>     "bool": {
>       "must": [
>        
>         {
>           "nested": {
>             "path": "store_purchase", 
>             "query": {
>               "bool": {
>                 "must": [ 
>                   { "match": { "store_purchase.cat": "otc" }}
>                 ]
>         }}}}
>       ]
> }}}
>
> i also tried with    { "match": { "store_purchase.cat.original": "otc" }}, 
> it all returns nothing.
>
> What I am missing here?
> Thanks,
> Chen
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/185cfeaf-1788-48c7-af72-ee98fa8ed956%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to