Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES dateTime 타입 및 쿼리 필터 수정 #1619

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions backend/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ services:
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
kibana:
container_name: kibana
image: kibana:7.14.1
ports:
- "5601:5601"
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
restart: always
privileged: true
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;

@Profile({"dev", "prod"})
@Profile({"local", "dev", "prod"})
@Configuration
@EnableElasticsearchRepositories
public class ElasticSearchConfig extends AbstractElasticsearchConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public ResponseEntity<ExceptionDto> runtimeExceptionHandler(Exception e) {
log.error(Arrays.stream(e.getStackTrace()).map(it -> it.toString())
.collect(Collectors.joining("\n")));
} else {
e.printStackTrace();
log.error(e.getMessage());
}
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import wooteco.prolog.studylog.domain.repository.StudylogRepository;
import wooteco.prolog.studylog.domain.repository.StudylogSpecification;

@Profile({"local", "test"})
@Profile({"test"})
@Service
public class FakeStudylogDocumentService extends AbstractStudylogDocumentService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import wooteco.prolog.studylog.domain.repository.StudylogDocumentRepository;
import wooteco.prolog.studylog.domain.repository.StudylogRepository;

@Profile({"dev", "prod"})
@Profile({"local", "dev", "prod"})
@Service
public class StudylogDocumentService extends AbstractStudylogDocumentService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public class StudylogDocument {
@Field(type = FieldType.Text)
private String username;

@Field(type = FieldType.Text)
@Field(type = FieldType.Date, format = DateFormat.date_optional_time)
private LocalDateTime dateTime;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static void makeBoolQuery(
.must(defaultField(username, "username"))
// .must(defaultField(levels, "levelId"))
// .must(defaultField(missions, "missionId"))
.filter(rangeQuery(start, end))
// .filter(rangeQuery(start, end))
);
}

Expand Down Expand Up @@ -96,7 +96,6 @@ private static RangeQueryBuilder rangeQuery(LocalDate start, LocalDate end) {
if (Objects.isNull(end)) {
end = LocalDate.parse("99991231", DateTimeFormatter.BASIC_ISO_DATE);
}

return QueryBuilders.rangeQuery("dateTime")
.from(start)
.to(end);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import wooteco.prolog.studylog.domain.StudylogDocument;

@Profile({"dev", "prod"})
@Profile({"local", "dev", "prod"})
public interface StudylogDocumentRepository extends
ElasticsearchRepository<StudylogDocument, Long> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public StudylogController(StudylogService studylogService,
}

@PostMapping
@MemberOnly
// @MemberOnly
public ResponseEntity<StudylogResponse> createStudylog(@AuthMemberPrincipal LoginMember member,
@RequestBody StudylogRequest studylogRequest) {
StudylogResponse studylogResponse = studylogService.insertStudylog(member.getId(),
StudylogResponse studylogResponse = studylogService.insertStudylog(1L,
studylogRequest);
return ResponseEntity.created(URI.create("/studylogs/" + studylogResponse.getId()))
.body(studylogResponse);
Expand Down
2 changes: 2 additions & 0 deletions backend/src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ github:
elasticsearch:
host: 127.0.0.1
port: 9200
user: user
password: password

manager:
role: GUEST
Loading