Hello,
I have a question about kibana and any help is welcome, I'm stuck on this for a week.
I have two indexes (index1 and index2 let's say) and I want to create a mapping in index1 which has as name change and whose value must be good or not good depending on the script:
The script looks for an ip in index1, if there is a match in the ipAdress of index2, if yes it returns "match" otherwise it is "no match".
So I would like to know how to build this mapping on kinana to make this match or it's another method that will do it, what is it.
I attach the mapping below for more clarity. Thanks in advance
index1/_doc
{
"ip": "192.168.1.1",
"country": "Canada",
"city": "Montreal"
}
index2/
{
{
"ipAdress": "192.168.1.1"
},
{
"ipAdress": "192.168.1.1"
}
{
"ipAdress": "192.168.1.1"
}}
PUT index1/_mapping
{
"runtime": {
"match": {
"type": "keyword",
"target_index": "index2",
"input_field": "ip",
"target_field": "ipAdress"
"script": """
def D = all doc['ipAdress.keyword'].value
def val = doc['ip.keyword'].value;
for (int i=0; i < D.length; i++){
if ( val == D[i] ) return emit("match');}
return emit('Not match')
"""
}
},
"fields": ["match"]
}
}