I am trying to retrieve data from ES using the search API.
The name of the index is index_certificate
and the document type is doc_certificate
.
Below API call works fine and returns results.
curl -X POST "http://elasticsearch:9200/index_certificate/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"bool": {
"must": [
{
"match": {
"district_id": {
"query": "10"
}
}
}
]
}
}
}'
But if I add the document type to the url without changing any other thing as below, it returns an empty result array. (Does not throw any errors)
curl -X POST "http://elasticsearch:9200/index_certificate/doc_certificate/_search?pretty" -H 'Content-Type: application/json' -d' { "query": { "bool": { "must": [ { "match": { "district_id": { "query": "10" } } } ] } } }'
I am not the one who did setup the node. Also this is not a production node. I am not sure whether this can be due to a read/write permission issue related to the document. I appreciate if someone can help me to solve this. Thank you.
question from:
https://stackoverflow.com/questions/65941815/elasticsearch-search-api-does-not-return-results-when-called-with-document-type 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…