let's say I have 3 document types (A, B and C) and I want to implement one
unified search box which returns results group by their document type (see
link above)
If I search in type A (/index/A/_search?q=someString* ) I get 1 hit:
If I search in type B (/index/B/_search?q=someString*) I get 108 hits.
By default only the top 10 hits are returned.
Now if I search in both document types (/index/A,B/_search?q=someString*) I
get 109 hits. It again only displays the top 10 hits.
However it only display hits from document type B and not the one from A.
Is there any easy way to return the same amount of hits for each document
type in one search?
Or do I have to do 3 distinct searches and then group them afterwards ? Can
facets help me here?
let's say I have 3 document types (A, B and C) and I want to implement one
unified search box which returns results group by their document type (see
link above)
If I search in type A (/index/A/_search?q=someString* ) I get 1 hit:
If I search in type B (/index/B/_search?q=someString*) I get 108 hits.
By default only the top 10 hits are returned.
Now if I search in both document types (/index/A,B/_search?q=someString*) I
get 109 hits. It again only displays the top 10 hits.
However it only display hits from document type B and not the one from A.
Is there any easy way to return the same amount of hits for each document
type in one search?
Or do I have to do 3 distinct searches and then group them afterwards ? Can
facets help me here?
@David,
Ah thanks. I apparently missed that part about multi serach. I will look
into it. BTW are there some best practices for doing these kind of unified
search across document types (think one should be aware of or take care)?
On Mon, Nov 19, 2012 at 3:52 PM, David Pilato david@pilato.fr wrote:
**
Perhaps Multi search is what you are looking for?
let's say I have 3 document types (A, B and C) and I want to implement one
unified search box which returns results group by their document type (see
link above)
If I search in type A (/index/A/_search?q=someString* ) I get 1 hit:
If I search in type B (/index/B/_search?q=someString*) I get 108 hits.
By default only the top 10 hits are returned.
Now if I search in both document types (/index/A,B/_search?q=someString*)
I get 109 hits. It again only displays the top 10 hits.
However it only display hits from document type B and not the one from
A.
Is there any easy way to return the same amount of hits for each document
type in one search?
Or do I have to do 3 distinct searches and then group them afterwards ?
Can facets help me here?
The Multi-search solves my problem.
However using the JAVA API I ran into an issue with the returned hits.
I create a MutliSearchRequestBuilder and add 3 distinct
SearchRequestBuilders to it and I specify the size to be 10 (using
setSize()).
However they always return 50 hits no matter which size I specify.
Here is how the SearchRequestBuilder looks like:
let's say I have 3 document types (A, B and C) and I want to implement one
unified search box which returns results group by their document type (see
link above)
If I search in type A (/index/A/_search?q=someString* ) I get 1 hit:
If I search in type B (/index/B/_search?q=someString*) I get 108 hits.
By default only the top 10 hits are returned.
Now if I search in both document types (/index/A,B/_search?q=someString*)
I get 109 hits. It again only displays the top 10 hits.
However it only display hits from document type B and not the one from
A.
Is there any easy way to return the same amount of hits for each document
type in one search?
Or do I have to do 3 distinct searches and then group them afterwards ?
Can facets help me here?
The Multi-search solves my problem.
However using the JAVA API I ran into an issue with the returned hits.
I create a MutliSearchRequestBuilder and add 3 distinct
SearchRequestBuilders to it and I specify the size to be 10 (using
setSize()).
However they always return 50 hits no matter which size I specify.
Here is how the SearchRequestBuilder looks like:
let's say I have 3 document types (A, B and C) and I want to implement
one unified search box which returns results group by their document type
(see link above)
If I search in type A (/index/A/_search?q=*someString ) I get 1
hit:
If I search in type B (/index/B/_search?q=*someString) I get 108
hits.
By default only the top 10 hits are returned.
Now if I search in both document types (/index/A,B/_search?q=*someString)
I get 109 hits. It again only displays the top 10 hits.
However it only display hits from document type B and not the one from
A.
Is there any easy way to return the same amount of hits for each
document type in one search?
Or do I have to do 3 distinct searches and then group them afterwards ?
Can facets help me here?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.