Ability to search accross 'types' in the same index, with different search parameters yet applying the same size and from values, in a single search query


(Ajinkya Apte) #1

Hello,
Examples of some documents:

POST /test-index/test-type-1/doc-1
{
"text" : "Some text",
"status" : 1
}

POST /test-index/test-type-2/doc-1
{
"text" : "Some new text",
"status" : 1
}

POST /test-index/test-type-2/doc-2
{
"text" : "Some even new text",
"status" : 2
}

Is there a single query I can use so that I can get all the documents that
are of 'status'=1 in 'type'='test-type-1' and 'status'=2 in
'type'='test-type-2' applying the same 'size' and 'from' params? As of
right now I am running two different queries and then I am trying to merge
them programatically. Any better way you recommend?

AJ

--
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/7f6bac9f-8fc3-4886-8a70-4dac81424073%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

Hello AJ ,

You can do this as follows

{
"query_string" : {
"query" : "test-type1.status:1 || test-type2.status:2"
}

But then there is a bug associated with a corner condition of this -


So be a bit careful.

Thanks
Vineeth

Thanks
Vineeth

}

On Tue, Aug 26, 2014 at 1:21 PM, Ajinkya Apte ajinx14@gmail.com wrote:

Hello,
Examples of some documents:

POST /test-index/test-type-1/doc-1
{
"text" : "Some text",
"status" : 1
}

POST /test-index/test-type-2/doc-1
{
"text" : "Some new text",
"status" : 1
}

POST /test-index/test-type-2/doc-2
{
"text" : "Some even new text",
"status" : 2
}

Is there a single query I can use so that I can get all the documents that
are of 'status'=1 in 'type'='test-type-1' and 'status'=2 in
'type'='test-type-2' applying the same 'size' and 'from' params? As of
right now I am running two different queries and then I am trying to merge
them programatically. Any better way you recommend?

AJ

--
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/7f6bac9f-8fc3-4886-8a70-4dac81424073%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/7f6bac9f-8fc3-4886-8a70-4dac81424073%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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/CAGdPd5nkrc8beGyi-tLgox4Ec25H%2BUftBTy1-Q7xbwXOP4RMVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3