curl -XGET 'http://localhost:9200/test/publication/1/_explain?pretty' -d '{"query": {"match": {"name": "роза"}}}'
{
"_index" : "test",
"_type" : "publication",
"_id" : "1",
"matched" : true,
"explanation" : {
"value" : 0.30685282,
"description" : "sum of:",
"details" : [ {
"value" : 0.30685282,
"description" : "weight(name:роза in 0) [PerFieldSimilarity], result of:",
"details" : [ {
"value" : 0.30685282,
"description" : "fieldWeight in 0, product of:",
"details" : [ {
"value" : 1.0,
"description" : "tf(freq=1.0), with freq of:",
"details" : [ {
"value" : 1.0,
"description" : "termFreq=1.0",
"details" : [ ]
} ]
}, {
"value" : 0.30685282,
"description" : "idf(docFreq=1, maxDocs=1)",
"details" : [ ]
}, {
"value" : 1.0,
"description" : "fieldNorm(doc=0)",
"details" : [ ]
} ]
} ]
}, {
"value" : 0.0,
"description" : "match on required clause, product of:",
"details" : [ {
"value" : 0.0,
"description" : "# clause",
"details" : [ ]
}, {
"value" : 3.2588913,
"description" : "_type:publication, product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost",
"details" : [ ]
}, {
"value" : 3.2588913,
"description" : "queryNorm",
"details" : [ ]
} ]
} ]
} ]
}
}
curl -XGET 'http://localhost:9200/test/publication/2/_explain?pretty' -d '{"query": {"match": {"name": "роза"}}}'
{
"_index" : "test",
"_type" : "publication",
"_id" : "2",
"matched" : true,
"explanation" : {
"value" : 0.4451987,
"description" : "sum of:",
"details" : [ {
"value" : 0.4451987,
"description" : "weight(name:роза in 0) [PerFieldSimilarity], result of:",
"details" : [ {
"value" : 0.4451987,
"description" : "fieldWeight in 0, product of:",
"details" : [ {
"value" : 1.0,
"description" : "tf(freq=1.0), with freq of:",
"details" : [ {
"value" : 1.0,
"description" : "termFreq=1.0",
"details" : [ ]
} ]
}, {
"value" : 0.71231794,
"description" : "idf(docFreq=3, maxDocs=3)",
"details" : [ ]
}, {
"value" : 0.625,
"description" : "fieldNorm(doc=0)",
"details" : [ ]
} ]
} ]
}, {
"value" : 0.0,
"description" : "match on required clause, product of:",
"details" : [ {
"value" : 0.0,
"description" : "# clause",
"details" : [ ]
}, {
"value" : 1.4038675,
"description" : "_type:publication, product of:",
"details" : [ {
"value" : 1.0,
"description" : "boost",
"details" : [ ]
}, {
"value" : 1.4038675,
"description" : "queryNorm",
"details" : [ ]
} ]
} ]
} ]
}
}
class MyRouter(object):
def db_for_read(self, model, **hints):
if model.__module__.startswith('django.contrib'):
return 'default'
return 'mydb'
def db_for_write(self, model, **hints):
if model.__module__.startswith('django.contrib'):
return 'default'
return 'mydb'
def allow_relation(self, obj1, obj2, **hints):
# тут уже сам напиши
def allow_migrate(self, db, app_label, model_name=None, **hints):
return True