1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.common.database.requests;
20 import org.json.JSONObject;
22 //https://github.com/elastic/elasticsearch/blob/6.4/rest-api-spec/src/main/resources/rest-api-spec/api/indices.create.json
23 //https://github.com/elastic/elasticsearch/blob/6.4/rest-api-spec/src/main/resources/rest-api-spec/api/indices.put_mapping.json
24 public class CreateIndexRequest extends BaseRequest{
26 private JSONObject settings;
27 private JSONObject mappings;
29 public CreateIndexRequest(String index) {
30 super("PUT","/"+index);
31 this.mappings=new JSONObject();
34 private void setRequest() {
36 JSONObject o=new JSONObject();
37 if(this.mappings!=null) {
38 o.put("mappings", this.mappings);
40 if(this.settings!=null) {
41 o.put("settings", this.settings);
45 public void mappings(JSONObject mappings) {
46 this.mappings=mappings;
50 public void settings(JSONObject settings) {
51 this.settings = settings;
55 public boolean hasMappings() {
56 return this.mappings!=null;
59 public boolean hasSettings() {
60 return this.settings!=null;