모든 다큐먼트는 uid라는 식별자를 가지고 있다. _id 말고, 사용자는 보이지 않지만 쓰이지 않는 키가 있다. 

다큐먼트 타입에 _id 값이 더하진 문자열이다. 타입이 location이고 _id가 12345 라면, _uid는 location#12345 이다. 


일래스틱서치는 색인을 주지 않더라도 타입과 다큐먼트 id만 줄 때, 검색할 수 있다. 최소한 이 때 사용한다고 할 수 있다. 


관련 테스트 코드는 SimpleValidateQueryTests.java에 있다.  


final String typeFilter = filter("_type:type1");

assertExplanation(QueryBuilders.queryString("_id:1"),        equalTo("filtered(ConstantScore(_uid:type1#1))->" + typeFilter));


assertExplanation(QueryBuilders.idsQuery("type1").addIds("1").addIds("2"),

 equalTo("filtered(ConstantScore(_uid:type1#1 _uid:type1#2))->" + typeFilter));




Posted by '김용환'
,