URI Search 방법을 사용하여 문서를 검색하면 올바른 문서가 반환되지만 API DSL을 사용하면 문서를 찾을 수 없습니다. Elasticsearch가 DSL을 사용하는 기존 문서를 찾지 못했습니다
이 문제를 재현하려면 :curl http://localhost:9299/integrationtest-index?pretty
{
"integrationtest-index" : {
"aliases" : { },
"mappings" : {
"searchable" : {
"properties" : {
"field1" : {
"type" : "string"
},
"ref" : {
"type" : "string"
}
}
}
},
"settings" : {
"index" : {
"field1" : "value1",
"ref" : "XXXX2",
"number_of_shards" : "5",
"creation_date" : "1466780216631",
"number_of_replicas" : "1",
"uuid" : "GBj2VF-wQy6JP74AqoIn5g",
"version" : {
"created" : "2020099"
}
}
},
"warmers" : { }
}
}
: 그래서 인덱스가 기본 매핑 (검색 형)로 자동으로 생성됩니다
curl http://localhost:9299/integrationtest-index/searchable/ID_XXXX2 -d '{ "ref" : "XXXX2", "field1" : "value1" }'
: 생성 된 인덱스없이
을, 나는이 문서를 삽입
이 쿼리는 하나의 문서를 반환합니다.
curl http://localhost:9299/integrationtest-index/searchable/_search?q=ref:XXXX2
하지만 존재하지 않는이 다른 쿼리 응답 :
curl -XPOST http://localhost:9299/integrationtest-index/searchable/_search/exists -d '
{
"query": {
"term" : {
"ref" : "XXXX2"
}
}
}'
을 마지막 쿼리가 문서가 존재하지 않는다고 말했다 이유는 무엇입니까?
환경 :
- ElasticSearch 2.2.0
- 우분투 16.04 LTS
- 오픈 JDK 런타임 환경
기술적으로 그것은'query_string' 쿼리를 사용하고, 아닌'match' 쿼리. – pickypg
@pickypg 의견을 주셔서 감사합니다. 그것이 올바른지 알고 있습니까? – angelcervera
충분히 닫습니다. 그러나 원시 쿼리 자체를 업데이트해야합니다. – pickypg