Azima
Azima

Reputation: 4141

elasticsearch document found false

I am trying to access a document with _id.

I recently dumped an index from remote server to my local server.

Here's how I am trying to get the document:

GET http://localhost:9200/dmap_product_match/dmap_product_match/ZA2JeGsBsz9baORiZSkN

And in response:

{
    "_index": "dmap_product_match",
    "_type": "dmap_product_match",
    "_id": "ZA2JeGsBsz9baORiZSkN",
    "found": false
}

But requesting for the document as a query body returns the document:

GET http://localhost:9200/dmap_product_match/_search

{
    "_source": ["s_item_name","r_item_name","human_verdict"],
    "query": {
        "term":{
            "_id": "ZA2JeGsBsz9baORiZSkN"
        }
    }
}

EDIT: elasticsearch v7.0.0.

Upvotes: 3

Views: 1612

Answers (1)

Jorge
Jorge

Reputation: 161

ElasticSearch is not finding the document you are asking for because the document type is not well defined in the request.

The api to fetch documents has the following format:

GET http://<host>:<port>/<index>/<type>/<docId>

According to the request you post, you are looking for the document with the id ZA2JeGsBsz9baORiZSkN in the index dmap_product_match and type dmap_product_match.

Your request should be something like:

GET http://localhost:9200/dmap_product_match/_doc/ZA2JeGsBsz9baORiZSkN

Upvotes: 4

Related Questions