-
Notifications
You must be signed in to change notification settings - Fork 52
Indus
Yann Barraud edited this page Dec 24, 2013
·
1 revision
Once you are certain of your script parametrization, it is quite comfortable to store it in Elasticsearch.
{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"entity-configuration": {
"properties": {
"name": {
"type": "string",
"index": "not_analyzed"
},
"comparator": {
"type": "string",
"index": "not_analyzed"
},
"low": {
"type": "double"
},
"high": {
"type": "double"
},
"cleaners": {
"type": "string",
"index" : "not_analyzed"
}
}
}
}
}
{
"entity" : {
"fields" : [ {
"field" : "city",
"cleaners" : [ {
"name" : "no.priv.garshol.duke.cleaners.TrimCleaner"
}, {
"name" : "no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"
} ],
"high" : 0.95,
"comparator" : {
"name" : "no.priv.garshol.duke.comparators.JaroWinkler"
},
"low" : 0.1
}, {
"field" : "state",
"cleaners" : [ {
"name" : "no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"
} ],
"high" : 0.95,
"comparator" : {
"name" : "no.priv.garshol.duke.comparators.JaroWinkler"
},
"low" : 0.1
}, {
"field" : "population",
"cleaners" : [ {
"name" : "no.priv.garshol.duke.cleaners.DigitsOnlyCleaner"
} ],
"high" : 0.95,
"comparator" : {
"name" : "no.priv.garshol.duke.comparators.NumericComparator"
},
"low" : 0.1
}, {
"field" : "position",
"cleaners" : [ {
"name" : "no.priv.garshol.duke.cleaners.LowerCaseNormalizeCleaner"
} ],
"high" : 0.95,
"comparator" : {
"name" : "no.priv.garshol.duke.comparators.GeopositionComparator",
"params" : {
"max-distance" : "100"
}
},
"low" : 0.1
} ]
}
}
{
"size": 4,
"query": {
"custom_score": {
"query": {
"match_all": {
}
},
"script": "entity-resolution",
"lang": "native",
"params": {
"entity": {
"configuration": {
"index": "entity",
"type": "entity-configuration",
"name": "test"
},
"fields": [
{
"field": "city",
"value": "South"
},
{
"field": "state",
"value": "ME"
},
{
"field": "population",
"value": "26000"
},
{
"field": "position",
"value": "43,70"
}
]
}
}
}
}
}