You need to change your mapping and use nested docs.

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 22 févr. 2014 à 10:05, [email protected] a écrit :

> Hi all:
> 
>   If  the data format is following, can elasticsearch  query it correctly?
> 
> The first data like this:
> A:
> {
> 
>    
> "attrspec_id":[{"attr_id":55,"attr_value":"barnd","optiona":[{"option_id":5710,"option_value":"Dell"},{"attr_id":39715,"attr_value":"type","option_id":0,"option_value":"8135"}]
> }
> 
> The second data like this:
> B
> 
> {
> 
>    
> "attrspec_id":[{"attr_id":55,"attr_value":"barnd","option":[{"option_id":571,"option_value":"CX"},{"attr_id":39715,"attr_value":"type","option_id":0,"option_value":"8135"},.{"attr_id":48,"attr_value":"barnd","option":[{"option_id":5710,"option_value":"CPU
>  
> 4X"},{"attr_id":39715,"attr_value":"type","option_id":0,"option_value":"8135"}]
> }
> 
> if i uses the following query
> 
> {
> 
> "query_string" : {"default_operator":"and", "query":" attr_id:55 and 
> option.option_id:5710 "}}}
> 
> }
> 
> Both A and B is selected. In fact i want to select A.
> Thanks very much
> -- 
> 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/229523e1-1e94-46cc-be73-0ead541dbdab%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
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/A5167F95-BA3A-400D-9056-184E60055997%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to