creates a document

@param string $index
@param string $type
@param mixed  $document

@return \Elastification\Client\Response\ResponseInterface
@author Daniel Wendlandt
973858
public function create($index, $type, $document)
    {
        $request = $this->createRequestInstance(self::CREATE_DOCUMENT, $index, $type);
        $request->setBody($document);

        return $this->client->send($request);
    }
940596
public static function create($type, $content)
	{
		if (empty($type)) {
			throw new AlertTypeException('Unable to create message with invalid type.');
		}

		if (empty($content)) {
			throw new AlertContentException('Unable to create message with invalid content.');
		}

		return new self($type, $content);
	}
246781
Document createDocument(Entity entity) {
    int maxIndexingDepth = entity.getEntityType().getIndexingDepth();
    XContentBuilder contentBuilder;
    try {
      contentBuilder = XContentFactory.contentBuilder(JSON);
      XContentGenerator generator = contentBuilder.generator();
      generator.writeStartObject();
      createRec(entity, generator, 0, maxIndexingDepth);
      generator.writeEndObject();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    String documentId = toElasticsearchId(entity.getIdValue());
    return Document.create(documentId, contentBuilder);
  }
194844
private function insert($index, $type, $hrefOrScript)
    {
        self::$scriptList->insert($index, array($type, $hrefOrScript));
        return $this;
    }
484848
public String addMapDocument(String indexName, String indexType, Map params,ClientOptions clientOptions) throws ElasticSearchException{
		Object docId = null;
		Object parentId = null;
		Object routing = null;
		String refreshOption = null;
		if(clientOptions != null) {
			refreshOption = clientOptions.getRefreshOption();
			docId = clientOptions.getIdField() != null ? params.get(clientOptions.getIdField()) : null;
			parentId = clientOptions.getParentIdField() != null ? params.get( clientOptions.getParentIdField()) : null;
			routing = clientOptions.getRountField() != null ? params.get(clientOptions.getRountField()) : null;
		}
		return addDocument(  indexName,   indexType,   params,  docId,  parentId,  routing,  refreshOption);
	}
1174136
def create_document(doc) #:nodoc:
      http_response = call_server(:method => :post, :uri => "document/#{@database}", \
          :content_type => 'application/json', :data => doc.to_json)
      resp = process_response(http_response) do
        raise DataError, 'validation problem' if http_response.body =~ /OValidationException/
      end

      resp = ::JSON.parse(http_response.body) # workaround: https://groups.google.com/forum/?fromgroups=#!topic/orient-database/UJGAXYpHDmo
      resp.extend Orientdb4r::DocumentMetadata
      resp
    end
849821
private function checkTemplate($document, $type)
    {
        $area = $this->areas->get($type);

        return $document->getStructureType() === $area['template'];
    }
1124034
@Override
    public URI createDocument(URI docRemoteLocation, String fileExtension, String mediaType) throws DocumentException {

        log.debug("Creating document from {} - File extension: {}", docRemoteLocation, fileExtension);
        URI newDocUri = this.generateUniqueDocumentUri();
        try {
            URI internalDocUri = this.getDocumentInternalUri(newDocUri);
            File docDir = new File(internalDocUri);
            FileUtil.createDirIfNotExists(docDir);
            File file = new File(new StringBuilder(docDir.getAbsolutePath()).append("/index.").append(fileExtension).toString());
            FileOutputStream out = new FileOutputStream(file);
            FileUtil.createDirIfNotExists(file.getParentFile());
            URLConnection connection = docRemoteLocation.toURL().openConnection();
            connection.addRequestProperty("Accept", mediaType);
            int size = IOUtils.copy(connection.getInputStream(), out);
            log.info("Document internal URI - " + internalDocUri.toASCIIString() + " - " + size + " bytes.");
            storeMediaType(file.getAbsolutePath(), mediaType);
            if (fileExtension.equals("json")) {
                storeSwaggerApiDeclarations(file, docDir.getAbsolutePath(), docRemoteLocation, mediaType);
            }
        } catch (IOException e) {
            throw new DocumentException("Unable to add document to service.", e);
        }

        // Generate Event
        this.getEventBus().post(new DocumentCreatedEvent(new Date(), newDocUri));

        return newDocUri;
    }
1184379
protected function __find($index, $type, $id) {
        try {
            $result = $this->client->get([
                'index' => $index,
                'type' => $type,
                'id' => $id
            ]);
            if ($result['found']) {
                return $this->_makeModel($result);
            } else {
                return null;
            }
        } catch (\Exception $e) {
            trigger_error($e->getMessage(), E_USER_WARNING);
            return null;
        }
    }
1184557
protected function createBlueprint($type, Closure $callback = null, $index = null)
    {
        if (isset($this->resolver)) {
            return call_user_func($this->resolver, $type, $callback, $index);
        }

        return new Blueprint($type, $callback, $index);
    }
1033021
public function addDocument($indexName, $indexType, $document, $uid)
    {
        $doc = $this->createDocument($uid, $document);

        return $this->getClient()->getIndex($indexName)->getType($indexType)->addDocument($doc);
    }
378408
public function index($document)
    {
        $index = $this->client->getIndex($this->indexName);

        $this->indexDocument($document, $index);

        $index->refresh();
    }
64468
public function delete($indexName, $type, $id)
	{
		$index = $this->elasticSearcher->indicesManager()->getRegistered($indexName);

		$params = [
			'index' => $index->getInternalName(),
			'type'  => $type,
			'id'    => $id
		];

		return $this->elasticSearcher->getClient()->delete($params);
	}
867524
public function createDocument($document, $uid, $indexName = '', $indexType = '')
    {
        return new DocumentReference($document, $uid, $this->indexNamePrefix . $indexName, $indexType);
    }
1215430
public function removeDocuments(array $ids, $index, $type = '')
    {
        if (empty($type)) {
            $type = $this->typeName;
        }

        $client = $this->getClient();
        $index = $client->getIndex($index);

        $client->deleteIds($ids, $index, $type);

        // Refresh index because bulk deletions are slow
        $index->refresh();
    }
1257870
private function createStructure($document)
    {
        return new ManagedStructure(
            $this->contentTypeManager,
            $this->legacyPropertyFactory,
            $this->inspector,
            $document
        );
    }
218443
public <T> T getDocument(String indexName, String indexType,String documentId,Map<String,Object> options,Class<T> beanType) throws ElasticSearchException{
		try{
			SearchHit searchResult = this.client.executeRequest(BuildTool.buildGetDocumentRequest(  indexName,   indexType,  documentId,  options),null,   new GetDocumentResponseHandler( beanType),ClientUtil.HTTP_GET);

			return ResultUtil.buildObject(searchResult, beanType);
		}
		catch(ElasticSearchException e){
			return ResultUtil.hand404HttpRuntimeException(e,beanType,ResultUtil.OPERTYPE_getDocument);
		}

	}