나는 elasticsearch 검색 API가 붙어있다. 아무도 내가 여기서 뭘 잘못하고 있다고 말할 수 있습니까? 검색 API는 내가 클라이언트하지 1.Get elasticsearch 1.0.1자바 검색 API에서 히트를 반환하지 않는 Elasticsearch
에서
Client testClient = ElasticsearchIntegrationTest.client();
를 삽입 하십시오 일부 데이터
client.prepareIndex("elastic_index", "elastic_type", "1")
.setSource(jsonBuilder()
.startObject()
.field("ID", "1")
.field("value", "big")
.endObject())
.execute()
.actionGet();
3 테스트 클래스를 사용
작동 할 수 없습니다. 삽입 된 데이터 가져 오기 (현재 작동 중)GetResponse response = client.prepareGet("elastic_index", "elastic_type", "1")
.execute()
.actionGet();
4. 삽입 된 데이터를 검색하십시오 (작동하지 않음).
SearchResponse searchResponse = client.prepareSearch("elastic_index")
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(matchQuery("value", "big"))
.setFrom(0).setSize(60).setExplain(true)
.setTypes("elastic_type")
.execute()
.actionGet();
모든 종류의 QueryBuilder를 사용해 보았습니다. 반환 된 조회수는 항상 0입니다.
을 작동하려면 인덱스를 갱신했다 ('ESIntegTestCase'),'this.refresh()'도 똑같습니다. –