Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching with a PIT in a blank index returns the error 'field _id not found'" #984

Open
miafgen opened this issue Mar 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@miafgen
Copy link

miafgen commented Mar 27, 2024

Summary

Searching with a PIT in a blank index (which has never had a document) returns the error 'field _id not found'".

How can one reproduce the bug?

Steps to reproduce the behavior:
1. Create the index (PUT /dalisdata_buildings)
REQUEST:

--EMPTY--

RESPONSE:

{
  "acknowledged": true,
  "shards_acknowledged": true,
  "index": "dalisdata_buildings"
}

2. Request PIT (POST /dalisdata_buildings/_search/point_in_time?keep_alive=5m)
REQUEST:

--EMPTY--

RESPONSE:

{
  "pit_id": "o7OBQQETZGFsaXNkYXRhX2J1aWxkaW5ncxZneVRBenB5MlFGT3UxdzFxZDQ0NjJBABZZU2FPUGtDSlFfQ3FTMjJkMEY3LXJBAAAAAAAAAAA9FlFKV05tVjgtVDlteXplazYzNEFnUEEBFmd5VEF6cHkyUUZPdTF3MXFkNDQ2MkEAAA==",
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "creation_time": 1711555893091
}

3. Run first search using PIT (GET /_search) <=== The bug manifests itself in this step
REQUEST:

{
  "pit": {
    "id": "o7OBQQETZGFsaXNkYXRhX2J1aWxkaW5ncxZneVRBenB5MlFGT3UxdzFxZDQ0NjJBABZZU2FPUGtDSlFfQ3FTMjJkMEY3LXJBAAAAAAAAAAA9FlFKV05tVjgtVDlteXplazYzNEFnUEEBFmd5VEF6cHkyUUZPdTF3MXFkNDQ2MkEAAA=="
  },
  "slice": {
    "id": 0,
    "max": 2
  },
  "query": {
    "match_all": {}
  },
  "size": 10000
}

RESPONSE:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "field _id not found"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "dalisdata_buildings",
        "node": "YSaOPkCJQ_CqS22d0F7-rA",
        "reason": {
          "type": "illegal_argument_exception",
          "reason": "field _id not found"
        }
      }
    ],
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "field _id not found",
      "caused_by": {
        "type": "illegal_argument_exception",
        "reason": "field _id not found"
      }
    }
  },
  "status": 400
}

4. Add a document (PUT /dalisdata_buildings/_doc/foobar)
REQUEST:

{
  "foo": "bar"
}

RESPONSE:

{
  "_index": "dalisdata_buildings",
  "_id": "foobar",
  "_version": 1,
  "result": "created",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 0,
  "_primary_term": 1
}

5. Remove the previously added document (DELETE /dalisdata_buildings/_doc/foobar)
REQUEST:

--EMPTY--

RESPONSE:

{
  "_index": "dalisdata_buildings",
  "_id": "foobar",
  "_version": 2,
  "result": "deleted",
  "_shards": {
    "total": 2,
    "successful": 1,
    "failed": 0
  },
  "_seq_no": 1,
  "_primary_term": 1
}

6. Reexecute step 3 again (first search using PIT (GET /_search))
REQUEST:

{
  "pit": {
    "id": "o7OBQQETZGFsaXNkYXRhX2J1aWxkaW5ncxZneVRBenB5MlFGT3UxdzFxZDQ0NjJBABZZU2FPUGtDSlFfQ3FTMjJkMEY3LXJBAAAAAAAAAAA9FlFKV05tVjgtVDlteXplazYzNEFnUEEBFmd5VEF6cHkyUUZPdTF3MXFkNDQ2MkEAAA=="
  },
  "slice": {
    "id": 0,
    "max": 2
  },
  "query": {
    "match_all": {}
  },
  "size": 10000
}

RESPONSE:

{
  "pit_id": "o7OBQQETZGFsaXNkYXRhX2J1aWxkaW5ncxZneVRBenB5MlFGT3UxdzFxZDQ0NjJBABZZU2FPUGtDSlFfQ3FTMjJkMEY3LXJBAAAAAAAAAAA9FlFKV05tVjgtVDlteXplazYzNEFnUEEBFmd5VEF6cHkyUUZPdTF3MXFkNDQ2MkEAAA==",
  "took": 12,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 0,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  }
}

What is the expected behavior?
The expected response on step 3 is the one received in step 6, meaning:

{
  "pit_id": "o7OBQQETZGFsaXNkYXRhX2J1aWxkaW5ncxZneVRBenB5MlFGT3UxdzFxZDQ0NjJBABZZU2FPUGtDSlFfQ3FTMjJkMEY3LXJBAAAAAAAAAAA9FlFKV05tVjgtVDlteXplazYzNEFnUEEBFmd5VEF6cHkyUUZPdTF3MXFkNDQ2MkEAAA==",
  "took": 12,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": {
      "value": 0,
      "relation": "eq"
    },
    "max_score": null,
    "hits": []
  }
}

What is your host/environment ?

  • OS: Windows 11 (64bit)
  • Version: 2.12
  • Plugins: Disabled security. Otherwise standard installation.
@miafgen miafgen added bug Something isn't working untriaged labels Mar 27, 2024
@Swiddis Swiddis removed the untriaged label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants