일래스틱서치의 기본 인덱스의 필드 최대 개수는 1000이다.


만약 아래와 같은 에러가 발생했다면 다음 내용을 참조한다. 



Limit of total fields [1000] in index [인덱스 이름] has been exceeded.






https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html

Settings to prevent mappings explosionedit

Defining too many fields in an index is a condition that can lead to a mapping explosion, which can cause out of memory errors and difficult situations to recover from. This problem may be more common than expected. As an example, consider a situation in which every new document inserted introduces new fields. This is quite common with dynamic mappings. Every time a document contains new fields, those will end up in the index’s mappings. This isn’t worrying for a small amount of data, but it can become a problem as the mapping grows. The following settings allow you to limit the number of field mappings that can be created manually or dynamically, in order to prevent bad documents from causing a mapping explosion:

index.mapping.total_fields.limit
The maximum number of fields in an index. The default value is 1000.
index.mapping.depth.limit
The maximum depth for a field, which is measured as the number of inner objects. For instance, if all fields are defined at the root object level, then the depth is 1. If there is one object mapping, then the depth is 2, etc. The default is 20.
index.mapping.nested_fields.limit
The maximum number of nested fields in an index, defaults to 50. Indexing 1 document with 100 nested fields actually indexes 101 documents as each nested document is indexed as a separate hidden document.


필드 개수를 늘리는 것에 대해서 문서 뉘앙스는 bad이니 어느 정도부터는 성능 상 분명 존재할 것 같기도 하다..


굳이 변경하려면 다음과 같이 진행한다.



PUT 'localhost:9200/myindex/_settings' -d '

{

  "index.mapping.total_fields.limit": 10000

}'




그러나, 될 수 있으면 조심해서 쓰라고 하니. 참고하길 바란다.


https://discuss.elastic.co/t/limit-of-total-fields-1000-in-index-has-been-exceeded/87280/2


->(Elastic Team Member) Just understand that more fields is more overhead and that sparse fields cause trouble. So raise it with caution. Bumping into the limit is likely a sign that you are doing something that isn't going to work well with Elasticsearch in the future.


Posted by '김용환'
,

페이스북 광고 비딩에 대한 최신 정보가 담긴 내용이다.



https://adespresso.com/blog/everything-need-know-facebook-ads-bidding/

Posted by '김용환'
,


페이스북에서 explorer tab을 실험하고 있다. 




http://www.talkandroid.com/319666-facebook-testing-new-explore-feed-tab-on-android/



The Explore Feed is a way for users to access content that does not show up in their regular news feed. Based on a quick comparison, it appears many of the top stories correspond to the the Trending block that is present on the web interface on the desktop site. Other stories that appear are selected using algorithms that look at a user’s preferences and interests. The Explore Feed differs from the regular News Feed in that it is not limited to friends, pages, and groups that a user has elected to follow.



 


Posted by '김용환'
,



사용자 정의 maven jar를 사내 repository으로 업로드해야 할 떄 pom.xml을 굳이 고칠 필요가 없다. 간단히 아래와 같은 예제로 실행하면 사내 repository에 업로드(deploy)할 수 있다. 



$ mvn package 

// 성공


$ ls target/original-phoenix-0.0.1-SNAPSHOT.jar

original-phoenix-0.0.1-SNAPSHOT.jar



$ mvn -X deploy:deploy-file -DgroupId=com.google.phoenix -DartifactId=phoenix-core -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -Dfile=target/original-phoenix-0.0.1-SNAPSHOT.jar -Durl=http://maven.google.com/content/repositories/phoenix-snapshot



다음 주소에 확인하면 잘 올라갔는지 볼 수 있다 .


http://maven.google.com/content/repositories/phoenix-snapshot/com/google/phoenix/phoenix-core/0.0.1-SNAPSHOT/maven-metadata.xml



Posted by '김용환'
,



apache commons에 CircularFifoBuffer 클래스가 있다. 



첫번째 예시 코드이다.



object Test extends App {

import org.apache.commons.collections.buffer.CircularFifoBuffer

val tasks = new CircularFifoBuffer(10)
tasks.add(1)
tasks.add(2)
tasks.add(5)
tasks.add(6)
println("max size : " + tasks.maxSize)
println("size: " + tasks.size)
println("--get")
println(tasks.get())
println(tasks.get())
println(tasks.get())
println(tasks.get())

println("--remove")
println(tasks.remove)
println(tasks.remove)
println(tasks.remove)
println(tasks.remove)

println("-- error")
println(tasks.remove)
}


가지고 있는 buffer보다 더 많이 remove하면 exception이 발생한다. 

get을 호출하면 계속 첫번째 엘리먼트를 리턴한다. 현재 값 확인할 때 좋을 듯 하다. 


max size : 10

size: 4

--get

1

1

1

1

--remove

1

2

5

6


at org.apache.commons.collections.buffer.BoundedFifoBuffer.remove(BoundedFifoBuffer.java:275)





두 번째 예시 코드이다. 


object Test extends App {

import org.apache.commons.collections.buffer.CircularFifoBuffer

val tasks = new CircularFifoBuffer(10)
tasks.add(1)
tasks.add(2)
tasks.add(3)
tasks.add(4)
tasks.add(5)
tasks.add(6)
tasks.add(7)
tasks.add(8)
tasks.add(9)
tasks.add(10)
tasks.add(11)
tasks.add(12)
println("max size : " + tasks.maxSize)
println("size: " + tasks.size)

for(i <- tasks.toArray) {
println(tasks.remove)
}
}


데이터를 계속 추가하면 처음에 들어온 데이터는 삭제된다. overflow가 발생되지 않는다. 



max size : 10

size: 10

3

4

5

6

7

8

9

10

11

12


Posted by '김용환'
,

intellij에서 scala App을 실행할 때 다음과 같은 에러가 발생할 수 있다. 


Error: scala: No 'scala-library*.jar' in Scala compiler library in test



Open File -> Project Structures -> Libraries(또는 맥이라면 cmd + ;를 누름) 화면에서 scala sdk를 삭제한다. 


그리고 코드 화면으로 넘어가면 scala setup을 해야 한다는 경고창이 코드 뷰 상단에 뜨는데. scala setup 버튼을 누르면 잘 동작한다. 



이렇게 잘 안되면..


Open File -> Project Structures -> Libraries(또는 맥이라면 cmd + ;를 누름) 화면에서 scala sdk를 삭제하고 +를 눌러 수동으로 scala sdk를 선택한다.



### 추가 2017.11

그래도 안되면...버그다.



build.properties에 보니 sbt.version=1.0.2로 되어 있다.

검색해보니. sbt 버그였나 보다.


https://github.com/sbt/sbt/issues/3560

https://youtrack.jetbrains.com/issue/SCL-12591


sbt를 1.0.3으로 변경하고 build.properties의 sbt.version을 1.0.3으로 수정하니 문제가 발생하지 않는다. (또는 0.13.16으로 변경해야 할듯..)


Posted by '김용환'
,


젠킨스에서 반복적인 job은 job dsl 플러그인을 쓰면 편하다~

multi-job 대신 쓸만할 수도. 


https://wiki.jenkins.io/display/JENKINS/Job+DSL+Plugin



Configuration As Code: The Job DSL Plugin de Daniel Spilker




Posted by '김용환'
,




jenkins pipeline 플러그인은 사용하면 각 단계로 로그를 상세히 볼 수 있다!!!





어디 단계에서 문제가 발생하는지 보니까 완전 좋다!!



한국 분의 설치 내용

https://shortstories.gitbooks.io/studybook/content/jenkins_pipeline_c0bd_c9c8_ae30.html



결과 내용


참조 : https://www.cloudbees.com/blog/top-10-best-practices-jenkins-pipeline-plugin


 



Posted by '김용환'
,



우버(uber)에서 apache flink와 apache calcite 기반으로 SQL 기반의 스트리밍 분석 플랫폼(athenaX)을 내어놓았다.


https://eng.uber.com/athenax/


https://github.com/uber/AthenaX







잼난 부분을 소개하면 다음과 같다.


우버 개발자가 apache flink에 윈도우 관련 내용과 complex 타입을 지원하도록 PR을 보냈다. 기여했다.

https://issues.apache.org/jira/browse/FLINK-6377

https://github.com/apache/flink/pull/3665










기타 : 볼만한 내용


https://data-artisans.com/blog/session-windowing-in-flink



Streaming SQL from Julian Hyde




Introduction to Apache Calcite from Jordan Halterman




apache phoenix에서 apche calcite로 넘어가는 일은 얼마 안남은 듯.. 

Posted by '김용환'
,

java8 stream 사용시 주의할 점을 작성한 좋은 블로그 내용이 있어서 링크를 건다.



https://blog.jooq.org/2014/06/13/java-8-friday-10-subtle-mistakes-when-using-the-streams-api/



이 내용을 이용진 블로거님이 번역한 블로그이다.


http://leeyongjin.tistory.com/entry/Java8-%EC%9E%90%EB%B0%948-Stream-API-%EC%A3%BC%EC%9D%98%EC%82%AC%ED%95%AD


Posted by '김용환'
,