Indexes document.

@param name the name of the index.
@param type index type
@param id document id
@param doc document
@return true if document was indexed.
@throws IOException
15957
public boolean storeDocument(String name, String type, String id,
            EsRequest doc) throws IOException {
        CloseableHttpClient client = HttpClients.createDefault();
        HttpPost method = new HttpPost(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id));
        try {
            StringEntity requestEntity = new StringEntity(doc.toString(), ContentType.APPLICATION_JSON);
            method.setEntity(requestEntity);
            CloseableHttpResponse resp = client.execute(method);
            int statusCode = resp.getStatusLine().getStatusCode();
            return statusCode == HttpStatus.SC_CREATED || statusCode == HttpStatus.SC_OK;
        } finally {
            method.releaseConnection();
        }
    }
1338810
public boolean isExistsType(String indexName, String indexType) {
        TypesExistsResponse response =
                getClient().admin().indices()
                        .typesExists(new TypesExistsRequest(new String[]{indexName}, indexType)
                        ).actionGet();
        return response.isExists();
    }
573642
void addDocuments(final Document[] docs) throws IOException
   {
      final IndexWriter writer = getIndexWriter();

      IOException ioExc = null;
      try
      {
         for (Document doc : docs)
         {
            try
            {
               writer.addDocument(doc);
            }
            catch (Throwable e) //NOSONAR
            {
               if (ioExc == null)
               {
                  if (e instanceof IOException)
                  {
                     ioExc = (IOException)e;
                  }
                  else
                  {
                     ioExc = Util.createIOException(e);
                  }
               }

               log.warn("Exception while inverting document", e);
            }
         }
      }
      finally
      {
         invalidateSharedReader();
      }

      if (ioExc != null)
      {
         throw ioExc;
      }
   }
1030465
public Document<K> addDocument(K id, List<String> document)
    {
        SparseVector vector = toVector(document);
        Document<K> d = new Document<K>(id, vector);
        return documents_.put(id, d);
    }
392985
public void document_id_PUT(String id, OvhDocument body) throws IOException {
		String qPath = "/me/document/{id}";
		StringBuilder sb = path(qPath, id);
		exec(qPath, "PUT", sb.toString(), body);
	}
1249111
public function indexDocument($document)
    {
        if(isset($document['_id']['type']))
        {
            $collection = $this->config->getCollectionForSearchDocument($this->storeName, $document['_id']['type']);
        }
        else
        {
            throw new \Tripod\Exceptions\SearchException("No search document type specified in document");
        }

        try {
            $result = $collection->updateOne(array('_id' => $document['_id']), array('$set' => $document), array('upsert' => true));
            if (!$result->isAcknowledged()) {
                throw new \Tripod\Exceptions\SearchException("Inserting search document not acknowledged");
            }
        } catch (\Exception $e) {
            throw new \Tripod\Exceptions\SearchException("Failed to Index Document \n" . print_r($document, true), 0, $e);
        }
    }
252098
public static void setJdbcType(String typeName, int typeIndex, JdbcType type)
    {
        setJdbcTypeByName(typeName, type);
        setJdbcTypeByTypesIndex(typeIndex, type);
    }
1079941
public String addDateDocumentsWithIdKey(String indexName, String indexType, List<Map> beans,String docIdKey) throws ElasticSearchException{
		return addDocumentsWithIdKey(this.indexNameBuilder.getIndexName(indexName),   indexType,     beans,docIdKey);
	}
1106032
def _index_document(self, identifier, force=False):
        

        query = text("""
            INSERT INTO identifier_index(identifier, type, name)
            VALUES(:identifier, :type, :name);
        """)
        self.execute(query, **identifier)
1274709
public <T> T getDocument(String indexName, String indexType,String documentId,Class<T> beanType) throws ElasticSearchException{
		return getDocument(  indexName,   indexType,  documentId,(Map<String,Object>)null,beanType);
	}
553855
def __inst_doc(self, docid, doc_type_name=None):
        
        doc = None
        docpath = self.fs.join(self.rootdir, docid)
        if not self.fs.exists(docpath):
            return None
        if doc_type_name is not None:
            # if we already know the doc type name
            for (is_doc_type, doc_type_name_b, doc_type) in DOC_TYPE_LIST:
                if (doc_type_name_b == doc_type_name):
                    doc = doc_type(self.fs, docpath, docid)
            if not doc:
                logger.warning(
                    ("Warning: unknown doc type found in the index: %s") %
                    doc_type_name
                )
        # otherwise we guess the doc type
        if not doc:
            for (is_doc_type, doc_type_name, doc_type) in DOC_TYPE_LIST:
                if is_doc_type(self.fs, docpath):
                    doc = doc_type(self.fs, docpath, docid)
                    break
        if not doc:
            logger.warning("Warning: unknown doc type for doc '%s'" % docid)

        return doc
373420
def delete(self, doc_id: str) -> bool:
        """"""

        try:
            self.instance.delete(self.index, self.doc_type, doc_id)
        except RequestError as ex:
            logging.error(ex)
            return False
        else:
            return True
1269460
public SimpleOrderedMap<Object> create(ComponentDocument document,
      Boolean encode) throws IOException {
    SimpleOrderedMap<Object> mtasDocumentResponse = new SimpleOrderedMap<>();
    mtasDocumentResponse.add("key", document.key);
    ArrayList<NamedList<Object>> mtasDocumentItemResponses = new ArrayList<>();
    for (int docId : document.statsData.keySet()) {
      NamedList<Object> mtasDocumentItemResponse = new SimpleOrderedMap<>();
      MtasDataCollector<?, ?> stats = document.statsData.get(docId);
      MtasDataCollector<?, ?> list = null;
      if (document.statsList != null) {
        list = document.statsList.get(docId);
      }
      mtasDocumentItemResponse.add("stats",
          new MtasSolrMtasResult(stats, stats.getDataType(),
              stats.getStatsType(), stats.getStatsItems(), null, null));
      mtasDocumentItemResponse.add("documentKey",
          document.uniqueKey.get(docId));
      if (list != null) {
        if (document.listExpand) {
          mtasDocumentItemResponse.add("list",
              new MtasSolrMtasResult(list,
                  new String[] { list.getDataType(), list.getDataType() },
                  new String[] { list.getStatsType(), list.getStatsType() },
                  new SortedSet[] { list.getStatsItems(),
                      list.getStatsItems() },
                  new List[] { null, null }, new String[] { null, null },
                  new String[] { null, null }, new Integer[] { 0, 0 },
                  new Integer[] { 1, 1 }, null));
        } else {
          mtasDocumentItemResponse.add("list",
              new MtasSolrMtasResult(list, list.getDataType(),
                  list.getStatsType(), list.getStatsItems(), null, null));
        }

      }
      // add
      mtasDocumentItemResponses.add(mtasDocumentItemResponse);
    }
    mtasDocumentResponse.add("list", mtasDocumentItemResponses);
    MtasSolrResultUtil.rewrite(mtasDocumentResponse, searchComponent);
    return mtasDocumentResponse;
  }
1372562
public boolean deleteData(String indexName, String type, String id) {
        DeleteResponse response = getClient().prepareDelete().setIndex(indexName).setType(type).setId(id).execute().actionGet();
        return response.getResult() == DocWriteResponse.Result.DELETED;
    }
127952
public String getDocument(String indexName, String indexType,String documentId) throws ElasticSearchException{
		return getDocument(indexName, indexType,documentId,(Map<String,Object>)null);
	}
636982
public void ensureIndex(DBObject keys, String name) throws MongoException {
        ensureIndex(keys, name, false);
    }
240196
public static final IndexReference indexRef(String indexName, IndexType type) {
        if (type == null) {
            return new IndexReference("`" + indexName + "`");
        }
        return new IndexReference("`" + indexName + "` USING " + type.toString());
    }