| #!/usr/bin/env sh |
| # |
| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| |
| # Delete all existing indices. |
| curl -XDELETE 'http://localhost:9200/_all/' |
| |
| # Create the PCAP index. |
| curl -XPUT 'http://localhost:9200/pcap_all/' -d '{ |
| "settings": { |
| "index.codec.bloom.load": false, |
| "index.compound_on_flush": false, |
| "index.compound_format": false, |
| "index.merge.policy.use_compound_file": false, |
| "index.refresh_interval": 120, |
| "index.action.write_consistency": false, |
| "index.translog.flush_threshold_ops": 100000, |
| "index.compound_on_flush": false, |
| "index.compound_format": false, |
| "index.merge.policy.use_compound_file": false, |
| "index.merge.policy.segments_per_tier": 50, |
| "index.merge.policy.max_merge_at_once_explicit": 50, |
| "index.merge.policy.max_merge_at_once": 30, |
| "index.merge.policy.floor_segment": 1 |
| }, |
| "mappings": { |
| "pcap": { |
| "_all": { |
| "enabled": false |
| }, |
| "_source": { |
| "includes": ["pcap_id"] |
| }, |
| "properties": { |
| "pcap_id": { |
| "type": "string", |
| "index": "no", |
| "postings_format": "Lucene41" |
| }, |
| "ip_protocol": { |
| "type": "long", |
| "precision_step" : 64 |
| }, |
| "src_addr": { |
| "type": "string", |
| "index": "not_analyzed", |
| "postings_format": "Lucene41" |
| }, |
| "src_port": { |
| "type": "long", |
| "precision_step" : 64 |
| }, |
| "dst_addr": { |
| "type": "string", |
| "index": "not_analyzed", |
| "postings_format": "Lucene41" |
| }, |
| "dst_port": { |
| "type": "long", |
| "precision_step" : 64 |
| } |
| } |
| } |
| } |
| }' |
| |
| # Seed Elasticsearch. |
| for file in seed/es/*.json |
| do |
| curl -s -XPOST --data-binary @$file 'http://localhost:9200/_bulk' |
| done |