sirensolutions / siren-join

[This is the old, single node version for Elasticsearch 2.x, see the latest "Siren Federate" plugin for distributed Elasticsearch 5.x and 6.x capabilities]
http://siren.io
GNU Affero General Public License v3.0
183 stars 60 forks source link

Using Elasticsearch internal "_id" in joining #87

Closed jadrol closed 8 years ago

jadrol commented 8 years ago

Hello

I would like to join records using ES internal _id field.

Something like this:

curl -XPOST http://localhost:9200/clients/client/1 -d'{
  "firstname": "john",
  "lastname": "smith",
  "id": 1, // for test purpose, if I specify this in "path" it works
  ...
}'

curl -XPOST http://localhost:9200/events/profile -d'{
  "client_id": 1,
  "test": "true",
  ....
}'

curl -XGET http://localhost:9200/events/profile/_coordinate_search?pretty -d'{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      },
      "filter": {
        "filterjoin": {
          "client_id": {
            "indices": [ "clients" ],
            "types": [ "client" ],
            "path": "_id",
            "query": {
              "bool": {
                "must": [
                  { "term": { "firstname": "john" } }
                ]
              }
            }
          }
        }
      }
    }
  }
}'

But I'm getting no hits there, when I use "id" from document source it is working. Is there possibility to achieve "_id" to be working.

I'm using Elasticsearch 2.3.3.

Regards

scampi commented 8 years ago

This issue is tracked in https://github.com/sirensolutions/siren-join/issues/63. In the comments there some solution is proposed.