I directly ran it from postman..
Below are the setting i have added.
GET http://localhost:9200/ppp6 --->>This gives the below output
{
"ppp6": {
"aliases": {},
"mappings": {
"doc": {
"properties": {
"body": {
"type": "string",
"similarity": "overlapsimilarity"
},
"index": {
"type": "string",
"similarity": "overlapsimilarity"
}
}
},
"er": {
"properties": {
"index": {
"type": "string"
},
"search": {
"type": "string"
}
}
}
},
"settings": {
"index": {
"creation_date": "1468298653590",
"number_of_shards": "5",
"uuid": "XorHvK2RRrKft_rnaJYMrg",
"version": {
"created": "1070299"
},
"number_of_replicas": "1",
"similarity": {
"overlapsimilarity": {
"type": "stefansavev.esplugins.OverlapSimilarityProvider",
"b": "0"
}
}
}
},
"warmers": {}
}
}
I have placed the jar from the below given git hub project in the ES_HOME/plugins directory https://github.com/stefansavev/elasticsearch-custom-similarity-example
Below are the data i have indexed.
GET http://localhost:9200/ppp6/_search
{
"took": 33,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 9,
"max_score": 1,
"hits": [
{
"_index": "ppp6",
"_type": "er",
"_id": "AVXdbGIQH55KQhunBScf",
"_score": 1,
"_source": {
"index": "abcgdfggas99",
"search": "12145444"
}
},
{
"_index": "ppp6",
"_type": "kk",
"_id": "4",
"_score": 1,
"_source": {
"index": "zzz abc zzz",
"body": "2323"
}
},
{
"_index": "ppp6",
"_type": "er",
"_id": "AVXdbIGCH55KQhunBScg",
"_score": 1,
"_source": {
"index": "xcvcx abc ccgdfggas99",
"search": "12145444"
}
},
{
"_index": "ppp6",
"_type": "kk",
"_id": "1",
"_score": 1,
"_source": {
"index": "ABC D",
"body": "77"
}
},
{
"_index": "ppp6",
"_type": "er",
"_id": "AVXdbNADH55KQhunBSci",
"_score": 1,
"_source": {
"index": "xcvcxabcgdfggas99",
"search": "56566"
}
},
{
"_index": "ppp6",
"_type": "er",
"_id": "AVXdbP4oH55KQhunBScj",
"_score": 1,
"_source": {
"index": "abc"
}
},
{
"_index": "ppp6",
"_type": "kk",
"_id": "2",
"_score": 1,
"_source": {
"index": "RRFRF ABC DDFDF",
"body": "11111"
}
},
{
"_index": "ppp6",
"_type": "er",
"_id": "AVXdbJ3BH55KQhunBSch",
"_score": 1,
"_source": {
"index": "abc asadfd dfdf dfsdfsfv sesfss",
"search": "12145444"
}
},
{
"_index": "ppp6",
"_type": "kk",
"_id": "3",
"_score": 1,
"_source": {
"index": "index abc pdfodp sfsd",
"body": "6546"
}
}
]
}
}
Then I searched for this
{"query":
{ "match":
{ "index":"abc"
}
}
}
The result was the same with this similarity settings and without this settings.The score was the same in both the cases.