Hi, Guess you'll can help...else please point time to the right thread.
I want to get the details where I have two documents as below:
"_index": "mydata2_ind1", "_type": "mytype" and fields as "edt", "urid" , "location"
"_index": "mydata_ind1", "_type": "mytype" and fields as "doj", "myid", "name"
I want to get the details where myid = urid.
I am not able to it with scripts, but there should a be simple way...
I am able to do it when I specify the value "105" as below , but it should be able to query with this condition myid = urid
/the below GET works fine/
GET /my*_ind1/_search
{
"query": {
"multi_match": {
"query" : "105",
"fields": ["myid", "urid"]
}
}
}
/this GET does not work and i know as this two separate doc, but is there a way? ***/
/*"No field found for [myid] in mapping with types []"**/
GET /my_ind1/_search
{
"query": {
"filtered": {
"filter": {
"script": {
"script": "doc['myid'].value == doc['urid'].value"
}
}
}
}
}
all scripts are given below. ES version 2.1.1
/*** note i have tried with and widout doc_values***/
{
"dynamic": "true",
"properties": {
"myid": {"type": "integer","doc_values" : true },
"name": {"type": "string", "index" : "not_analyzed","doc_values" : true},
"doj" : {"type": "date", "format": "MM/dd/yyyy HH:mm:ss||MM/dd/yyyy HH:mm","doc_values" : true }
}
}
PUT /mydata_ind1/mytype/105
{
"name" : "myname",
"myid" : 105,
"doj" : "10/20/2016 8:09"
}
{
"dynamic": "true",
"properties": {
"urid": {"type": "integer","doc_values" : true},
"location": {"type": "string", "index" : "not_analyzed","doc_values" : true},
"edt" : {"type": "date", "format": "MM/dd/yyyy HH:mm:ss||MM/dd/yyyy HH:mm||yyyy-MM-dd HH:mm:ss" ,"doc_values" : true }
}
}
PUT /mydata2_ind1/mytype/105
{
"location" : "urname and myname",
"urid" : 105,
"edt" : "10/15/2016 20:09"
}