Joining the results to another


(Akash) #1

My documents look like below,
{
"took": 22,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 88096,
"max_score": 1,
"hits": [
{
"_index": "elasticray_20155",
"_type": "documents",
"_id": "thread_1",
"_score": 1,
"_source": {
"entryClassPK": "thread_1",
"entryClassName": "MBThread",
}
},
{
"_index": "elasticray_20155",
"_type": "documents",
"_id": "thread_2",
"_score": 1,
"_source": {
"entryClassPK": "thread_2",
"entryClassName": "MBThread",
}
},
{
"_index": "liferay_elasticray_20155",
"_type": "documents",
"_id": "message_1",
"_score": 1,
"_source": {
"entryClassPK": "message_1",
"entryClassName": "MBMessage",
"title":"test message aaa",
"threadID":"thread_1"
}
},
{
"_index": "liferay_elasticray_20155",
"_type": "documents",
"_id": "message_2",
"_score": 1,
"_source": {
"entryClassPK": "message_2",
"entryClassName": "MBMessage",
"title":"test message bbb",
"threadID":"thread_2"
}
},
{
"_index": "liferay_elasticray_20155",
"_type": "documents",
"_id": "message_3",
"_score": 1,
"_source": {
"entryClassPK": "message_3",
"entryClassName": "MBMessage",
"title":"test message ccc",
"threadID":"thread_1"
}
}
]
}
}

I want to search in title where entryClassName is MBMessage,
But in return i need the set of documents where entryClassName is MBThread +(entryClassPK == threadID results of search)

is it possible ?


(Akash) #2

I am Using below query , where i get the list of threadid, but i need the whole document of it.
Where thread id is entryClassPk ,

GET elasticray_20155/_search
{
"size": 0,
"query": {
"query_string": {
"query": "+(entryClassName:MBMessage)+(title:test)"
}
},
"aggs":{
"threads":{
"terms" : { "field" : "threadId", "size" : 10}
}
}
}

can somebody help how can i go forward.,?


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.