본문 바로가기

전체 글

(159)
elastiesearch doc upsert https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#doc_as_upsert Update API | Elasticsearch Reference [7.6] | Elastic Updates a document using the specified script. POST / /_update/ Enables you to script document updates. The script can update, delete, or skip modifying the document. The update API also supports passing a partial document, which is merged into the e..
postgres 트리거 만들기 CREATE FUNCTION update_json_expedia_region_union() RETURNS TRIGGER AS $$ DECLARE BEGIN UPDATE expedia_region_union SET boundaries = ST_GeomFromGeoJSON(coordinates)::geometry, boundaries_nearby = ST_GeomFromGeoJSON(coordinates_nearby)::geometry WHERE region_id = NEW.region_id; UPDATE expedia_region_union SET add_continent = ( select json_agg(json_build_object('id', region_id, 'name', region_name_..
How to make a new list with a property of an object which is in another list https://stackoverflow.com/questions/10975913/how-to-make-a-new-list-with-a-property-of-an-object-which-is-in-another-list How to make a new list with a property of an object which is in another list Imagine that I have a list of certain objects: List And I need to generate another list including the ids of Students in the above list: List Avoiding using a loo... stackoverflow.com 올바른 질문과 깔쌈한 답변 ..
elasticsearch envelope search in postgis 상황 elasticsearch에서 조회해오던 지역 객체들을 postgis로 조회해온다. 방법 1 geometry 타입 컬럼으로 하나 만들어 둠. 2 postgis `ST_MakeEnvelope` 연산 사용. 해결 나의 경우엔 이렇게 썼음~ SELECT * FROM expedia_region_union WHERE boundaries && ST_MakeEnvelope(10.9351, 49.3866, 11.201, 49.5138, 4326); 참조 # https://github.com/perrygeo/spatial-search-showdown EXPLAIN ANALYZE SELECT name, country FROM geoname WHERE geoname.the_geom && ST_MakeEnvelope(10..
datatable row other child open ~datatable row를 하나만 열고 싶었쪙~ 예제 $('#example tbody').on('click', 'td.details-control', function () { var tr = $(this).closest('tr'); var row = table.row( tr ); if ( row.child.isShown() ) { row.child.hide(); tr.removeClass('shown'); } else { if ( table.row( '.shown' ).length ) { $('.details-control', table.row( '.shown' ).node()).click(); } row.child( format(row.data()) ).show(); tr.addClass('shown..
elastiesearch with multiple condition 예시 { "query": { "bool": { "filter": [ { "bool": { "should": [ { "term": { "region_type": "city" } } ] } }, { "wildcard": { "region_name": "*seoul*" } } ] } } } 참고 - https://stackoverflow.com/a/40755927/10194999 elasticsearch bool query combine must with OR I am currently trying to migrate a solr-based application to elasticsearch. I have this lucene query (( name:(+foo +bar) OR info:(+foo +bar) ..
2020.02 / [월간] 공부 DAY 03 http://postgis.refractions.net/docs/reference.html#Geometry_Constructors http://postgis.refractions.net/docs/reference.html#Geometry_Constructors postgis.refractions.net http://postgis.refractions.net/docs/ST_GeomFromGeoJSON.html ST_GeomFromGeoJSON postgis.refractions.net 이것으로 필요한 geometry 타입의 entity를 생성할 수 있는데, multipolygon이든 polygon이든 아님 point든, 타입을 geojson에서 geometry로 바꿔주기만 하니까 이걸 쓰면 됨..
sql 문 정리가 필요하지만 매번 썼던거 또 찾기도 싫고... 반복해서 사용하는 것은 저장해두기로. ex) 테스트로 사용하는 데이터 간단히 만들때. 일단... 러프하게 적어둔다... # table copy select * into 신_테이블 from 구_테이블; # 테이블 생성 create table 이름( 컬럼이름 자료형타입 ); # 테이블 삭제 DROP TABLE table_name; # 컬럼 추가 alter table expedia_region_union_copy add column "created_at" TIMESTAMP default now()::timestamp # 컬럼 삭제 alter table json_b_test_region_100_007 drop column "updated_at" # 컬럼 복사 ..