Different results by _percolate and _mpercolate


(Jürg Mumprecht) #1

My Setup: language-dependant indices for text-documents; separate language-dependant indices for percolators. So I need the parameter percolate_index. While _percolate accepts wildcard-indices like eg.: percolate _index : smd_* and brings results from all percolators _mpercolate brings without complaining results of only one of the percolator indices. Setting percolate_index to one single index both _percolate and _mpercolate bring the same results. Do I something wrong or is it a bug? (Elasticsearch 2.0 rc1)


(Mark Harwood) #2

Looks to work for me on 2.0 rc1 : https://gist.github.com/markharwood/2b64e3731d80c8a2b3ac

Can you post a similar gist that reproduces the issue?


(Jürg Mumprecht) #3

Thank you, Mark. First I was puzzled: I setup on my windows machine an abstraction of my environment. And unexpectedly it worked as it should. So I repeated the whole process on a centos machine with a new elasticsearch installation and it shows the reported error. So somehow the _mpercolate under centos handles names differently - be it wildcards or underescores or both.
I am not an expert on github; so I just added the reproduction steps below.
Please keep attention: somehow underscores dissappeared; I added also a comment on github. which hopefully shows the _...

// create 3 identical indices:

PUT /documents_de_1900_1950
PUT /test_a
PUT /test_b

{
"mappings": {
"doc": {
"properties": {
"name": {
"type": "string"
}
}
}
}
}

// percolators in testa, testb; document in documents:

PUT /test_a/.percolator/testForAorCommon
{
"query": {
"match": {
"name": "a common"
}
}
}

PUT /test_b/.percolator/testForBorCommon
{
"query": {
"match": {
"name": "b common"
}
}
}

PUT /documents_de_1900_1950/doc/testdocumenta
{
"name": "a"
}
PUT /documents_de_1900_1950/doc/testdocumentb
{
"name": "b"
}
PUT /documents_de_1900_1950/doc/testdocumentcommon
{
"name": "common"
}

// _percolate works as expected:
GET /documents_de_1900_1950/doc/testdocumentcommon/_percolate?percolate_index=test*

// response:
{
"took": 1,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"total": 2,
"matches": [
{
"_index": "test_b",
"_id": "testForBorCommon"
},
{
"_index": "test_a",
"_id": "testForAorCommon"
}
]
}

// mpercolate:
{"percolate" : {"index" : "documents_de_1900_1950", "type" : "doc", "id" : "testdocumentcommon", "percolate_index" : "test
*" } }
{}

// windows Result:
D:\curl-7.45.0-win64-mingw\bin>curl -XPOST "http://localhost:9200/_mpercolate?pretty" --data-binary "@mpercolator.txt"
{
"responses" : [ {
"took" : 1,
"_shards" : {
"total" : 10,
"successful" : 5,
"failed" : 0
},
"total" : 2,
"matches" : [ {
"_index" : "test_b",
"_id" : "testForBorCommon"
}, {
"_index" : "test_a",
"_id" : "testForAorCommon"
} ]
} ]
}

// linux Result:
[tomcat@office ~]$ curl -XPOST "http://192.168.2.60:9200/_mpercolate?pretty" --data-binary @perc.txt
{
"responses" : [ {
"took" : 19,
"_shards" : {
"total" : 10,
"successful" : 5,
"failed" : 0
},
"total" : 1,
"matches" : [ {
"_index" : "test_b",
"_id" : "testForBorCommon"
} ]
} ]
}


(system) #4