package com.bawei.es.remote.api;

import com.bawei.common.core.constant.ServiceNameConstants;
import com.bawei.common.core.domain.R;
import com.bawei.es.remote.factory.RemoteDocumentFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 文件服务
 *
 * @author bawei
 */
@FeignClient(contextId = "remoteDocumentService", value = ServiceNameConstants.ES_SERVICE, fallbackFactory = RemoteDocumentFallbackFactory.class)
public interface RemoteDocumentService
{
    @PostMapping("/doc/{indexName}")
    R queryList(@PathVariable(value = "indexName") String indexName, @RequestBody Map<String,Object> conditions);

    @PutMapping("/doc/{indexName}")
    R batchDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List<String> dataJson);

    @DeleteMapping("/doc/{indexName}")
    R batchDeleteDocument(@PathVariable(value = "indexName") String indexName, @RequestBody List<String> dataJson);
}
