Yeah, I thought the same way, but from the documentation:
PUT /my-index
{
"mappings": {
"_doc": {
"properties": {
"message": {
"type": "text"
},
"query": {
"type": "percolator"
}
}
}
}
}
and the same index is using to percolate with the stored document here:
PUT /my-index/_doc/2
{
"message" : "A new bonsai tree in the office"
}
GET /my-index/_search
{
"query" : {
"percolate" : {
"field": "query",
"index" : "my-index",
"type" : "_doc",
"id" : "2",
"version" : 1
}
}
}
Probably, it's just an example, but since percolator data mapping type was introduced, it's possible to use a single index both for documents and percolate queries, checked it right now: es-6-percolate-api.sh · GitHub
What's more interesting, in the documentation for 5.6 version for the same topic there's a separate type instead of field:
PUT /my-index
{
"mappings": {
"doctype": {
"properties": {
"message": {
"type": "text"
}
}
},
"queries": {
"properties": {
"query": {
"type": "percolator"
}
}
}
}
}
All this stuff in the docs a little bit confusing me that's why the topic question was born.
@Bernt_Rostad, @Thomas_Ardal what do you think?