hellboy  
                (hellboy)
               
                 
              
                  
                    April 15, 2015,  2:46pm
                   
                   
              1 
               
             
            
              Document has filter sub-document with fields to be searched
{ 
customField1: customFieldValue1, 
... 
// Fields to be filtered 
filter : { 
firstFieldName: firstFieldValue, 
secondFieldName: secondFieldValue, 
} 
}
I need to search for exact values within filter fields with  OR - operator.
As I mentioned for exact-value searches, probably filter is the best option 
instead of a query, as a filter will be cached.
But I am not sure 
This search request filters only firstFieldValue properly
POST /index/type/_search 
{ 
"filter": { 
"bool": { 
"must": [ 
{ 
"term": { 
"filter.firstFieldName": "firstFieldValue" 
} 
}, 
{ 
"term": { 
"filter.secondFieldName": "secondFieldValue" 
} 
}, 
] 
} 
} 
}
And query matching works properly:
POST /index/type/_search 
{ 
"query": { 
"match": { 
"firstFieldName": "firstFieldValue" 
} 
} 
}
why?
 
-- 
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 elasticsearch+unsubscribe@googlegroups.com . 
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c43fe35b-09f3-41b1-811a-5bf4bb1d43e7%40googlegroups.com . 
For more options, visit https://groups.google.com/d/optout .
             
            
               
               
               
            
            
           
          
            
            
              Hello,
Could you give us the mapping of your document? Do you use nested fields 
(see this link
)?
If so, you should consider to use a nested query (see this link 
Nested Query | Elasticsearch Guide [1.5] | Elastic ). 
..
Thierry
2015-04-15 16:46 GMT+02:00 hellboy pbond81@gmail.com :
Document has filter sub-document with fields to be searched
{ 
customField1: customFieldValue1, 
... 
// Fields to be filtered 
filter : { 
firstFieldName: firstFieldValue, 
secondFieldName: secondFieldValue, 
} 
}
I need to search for exact values within filter fields with  OR - operator.
As I mentioned for exact-value searches, probably filter is the best 
option instead of a query, as a filter will be cached.
But I am not sure 
This search request filters only firstFieldValue properly
POST /index/type/_search 
{ 
"filter": { 
"bool": { 
"must": [ 
{ 
"term": { 
"filter.firstFieldName": "firstFieldValue" 
} 
}, 
{ 
"term": { 
"filter.secondFieldName": "secondFieldValue" 
} 
}, 
] 
} 
} 
}
And query matching works properly:
POST /index/type/_search 
{ 
"query": { 
"match": { 
"firstFieldName": "firstFieldValue" 
} 
} 
}
why?
 
-- 
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 elasticsearch+unsubscribe@googlegroups.com . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c43fe35b-09f3-41b1-811a-5bf4bb1d43e7%40googlegroups.com  
https://groups.google.com/d/msgid/elasticsearch/c43fe35b-09f3-41b1-811a-5bf4bb1d43e7%40googlegroups.com?utm_medium=email&utm_source=footer  
. 
For more options, visit https://groups.google.com/d/optout .
 
 -- 
Best, 
Thierry 
Thierry Templier, Lead Architect  
ttemplier@restlet.com 
Restlet SAS, 6 rue Rose Dieng-Kuntz • 44300 Nantes • France
-- 
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 elasticsearch+unsubscribe@googlegroups.com . 
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAL73BC3h9PKGK2NU2rYOep7R6AtOZAFrsAaM4c-fu-skXK5RZw%40mail.gmail.com . 
For more options, visit https://groups.google.com/d/optout .