2014-04-25 4 views
0

내가 여러 사용자가 로그인하고 그들이 전송 한 로그 데이터를 볼 수 있도록 Logstash, ElasticSearch키바 사용하고 색인 별칭의 용어 조회에 라우팅 필터를 지정합니다. 각 사용자에 대한 색인 별칭을 만들었습니다. 이렇게하면 자신의 데이터 만 포함하도록 결과가 제한됩니다.

사용자를 그룹에 할당하고 사용자가 그룹의 컴퓨터에 대한 데이터를 볼 수있게하고 싶습니다. 그룹과 사용자간에 상위 - 하위 관계를 만들고이 별칭에 용어 조회 필터를 만들었습니다.

별칭을 적용하려고하면 문제가 생깁니다. RoutingMissingException이 표시됩니다.

용어 검색 필터의 라우팅을 지정하는 방법이 있습니까? 상위 문서에서 용어를 검색하려면 어떻게해야합니까?

지도와 별칭을 아래에 게시했지만 전체 요점 레크리에이션은 link에서 사용할 수 있습니다. 이 오류에 대한 해결 방법을 찾기 위해 시도에서

curl -XPUT 'http://localhost:9200/accesscontrol/' -d '{ 
    "mappings" : { 
     "group" : { 
      "properties" : { 
       "name" : { "type" : "string" }, 
       "hosts" : { "type" : "string" } 
      } 
     }, 
     "user" : { 
      "_parent" : { "type" : "group" }, 
      "_routing" : { "required" : true, "path" : "group_id" }, 
      "properties" : { 
       "name" : { "type" : "string" }, 
       "group_id" : { "type" : "string" } 
      } 
     } 
    } 
}' 

# Create the logstash alias for cvializ 
curl -XPOST 'http://localhost:9200/_aliases' -d ' 
{ 
    "actions" : [ 
     { "remove" : { "index" : "logstash-2014.04.25", "alias" : "cvializ-logstash-2014.04.25" } }, 
     { 
      "add" : { 
       "index" : "logstash-2014.04.25", 
       "alias" : "cvializ-logstash-2014.04.25", 
       "routing" : "intern", 
       "filter": { 
        "terms" : { 
         "host" : { 
          "index" : "accesscontrol", 
          "type" : "user", 
          "id" : "cvializ", 
          "path" : "group.hosts" 
         }, 
         "_cache_key" : "cvializ_hosts" 
        } 
       } 
      } 
     } 
    ] 
}' 

답변

0

는, i를 ElasticSearch 팀 submitted a bug, 그리고 그들로부터 답변을 받았다. 필터가 동적 매핑 전에 적용되어 일부 잘못된 출력이 발생하는 것은 ElasticSearch의 버그였습니다. 아래에 해결 방법을 포함 시켰습니다.

PUT /accesscontrol/group/admin 
{ 
    "name" : "admin", 
    "hosts" : ["computer1","computer2","computer3"] 
} 


PUT /_template/admin_group 
{ 
    "template" : "logstash-*", 
    "aliases" : {   
     "template-admin-{index}" : { 
      "filter" : { 
       "terms" : { 
        "host" : { 
         "index" : "accesscontrol", 
         "type" : "group", 
         "id" : "admin", 
         "path" : "hosts" 
        } 
       } 
      } 
     } 
    }, 
    "mappings": { 
     "example" : { 
     "properties": { 
      "host" : { 
      "type" : "string" 
      } 
     } 
     } 
    } 
} 


POST /logstash-2014.05.09/example/1 
{ 
    "message":"my sample data", 
    "@version":"1", 
    "@timestamp":"2014-05-09T16:25:45.613Z", 
    "type":"example", 
    "host":"computer1" 
} 


GET /template-admin-logstash-2014.05.09/_search