Please provide solution ASAP.
I have two different index and i want to compare two fields value and get
result which exist in different index
for example :-
Index 1: message
fields :- 1. message id
2. message
3. userid
Index 2: user
fields:- 1. userid
2. user name
Need query : Give messageid, message, username
where message.userid = user.userid
I have tried script filter (query given below) but it is not working for
different document
curl -XGET 'http://localhost:9200/test1_index,test2_index/_search ' -d '
{ "query":
{ "filtered" : { "query" :
{ "match_all" : { } },
"filter" :
{ "script" :
{"script" : "doc["msgid"].value ==
doc["userid"].value" }
}
} }}'
--
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 .
For more options, visit https://groups.google.com/groups/opt_out .
1 Like
dadoonet
(David Pilato)
March 26, 2013, 9:13pm
2
I would say, index username in your message.
That's how you should think document.
Also, parent/child feature may help here...
My 2 cents (in ASAP answering mode ).
--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs
Le 26 mars 2013 à 21:58, harry harsh.mca9@gmail.com a écrit :
Please provide solution ASAP.
I have two different index and i want to compare two fields value and get result which exist in different index
for example :-
Index 1: message
fields :- 1. message id
2. message
3. userid
Index 2: user
fields:- 1. userid
2. user name
Need query : Give messageid, message, username
where message.userid = user.userid
I have tried script filter (query given below) but it is not working for different document
curl -XGET 'http://localhost:9200/test1_index,test2_index/_search ' -d '
{ "query":
{ "filtered" : { "query" :
{ "match_all" : { } },
"filter" :
{ "script" :
{"script" : "doc["msgid"].value == doc["userid"].value" }
}
} }}'
--
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 .
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 elasticsearch+unsubscribe@googlegroups.com .
For more options, visit https://groups.google.com/groups/opt_out .
mattweber
(Matt Weber)
March 26, 2013, 9:14pm
3
Currently the only way to do this is with parent/child functionality.. You
will want user to be the parent and message to be the child. Then use a
has parent query/filter.
Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.
On Tue, Mar 26, 2013 at 1:58 PM, harry harsh.mca9@gmail.com wrote:
Please provide solution ASAP.
I have two different index and i want to compare two fields value and get
result which exist in different index
for example :-
Index 1: message
fields :- 1. message id
2. message
3. userid
Index 2: user
fields:- 1. userid
2. user name
Need query : Give messageid, message, username
where message.userid = user.userid
I have tried script filter (query given below) but it is not working for
different document
curl -XGET 'http://localhost:9200/test1_index,test2_index/_search ' -d '
{ "query":
{ "filtered" : { "query" :
{ "match_all" : { } },
"filter" :
{ "script" :
{"script" : "doc["msgid"].value ==
doc["userid"].value" }
}
} }}'
--
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 .
For more options, visit https://groups.google.com/groups/opt_out .
--
Thanks,
Matt Weber
--
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 .
For more options, visit https://groups.google.com/groups/opt_out .
Thanx for quick reply.
I checked child parent queries and they have single index for different type doc and establish relationship between them but i have different index.
Would you please give me a simple example of it.
It would be much helpful.
And How to index username in message??? I don't have any idea.
Thanx for reply.
I checked child parent queries and they have single index for different type doc and establish relationship between them but i have different index.
Would you please give me a simple example of it.
It would be much helpful.