@Test public void testIndex() { try { esService.delIndex(index); List<TestDoc> allData = new ArrayList<>(); for (int i = 0; i < 1000; i++) { TestDoc tdoc = new TestDoc(index, type); tdoc.tint = i; tdoc.tdouble = i * 0.2; tdoc.tfloat = i * 0.2f; tdoc.tbool = i % 2 == 0; tdoc.tdate = new Date(); tdoc.tString = "abc中文测试乒乓球" + i * 0.2; tdoc.obj = new TestDoc(index, type); tdoc.obj.tint = i; tdoc.obj.tString = "父类" + i; allData.add(tdoc); } esService.createIndex(index, 3, 3); for (TestDoc d : allData) { esService.save(d); } } catch (Exception e) { LOG.error(e.getMessage(), e); fail(); } }
public Object index(String index, String type, Object body) throws Exception { Index action = esHelper.index(index, type, null); action.setBody(body); return esHelper.post(action, Object.class); }
EsBaseService { public Object index(String index, String type, Object body) throws Exception { Index action = esHelper.index(index, type, null); action.setBody(body); return esHelper.post(action, Object.class); } }
EsBaseService { public Object index(String index, String type, Object body) throws Exception { Index action = esHelper.index(index, type, null); action.setBody(body); return esHelper.post(action, Object.class); } EsBaseService(); }
EsBaseService { public Object index(String index, String type, Object body) throws Exception { Index action = esHelper.index(index, type, null); action.setBody(body); return esHelper.post(action, Object.class); } EsBaseService(); void init(String server, OkHttpClient client, IConvert convert); Object getMapping(String index); Object getMapping(String index, String type); Object putMapping(String index, String type, Object mapping); Object getIndex(String index); Object putIndexSettings(String index, Object settings); Object index(String index, String type, Object body); Object index(String index, String type, String id, Object body); Object get(String index, String type, String id); boolean delIndex(String index); Object openIndex(String index); Object closeIndex(String index); Object syncedFlushIndex(String index); Object flushIndex(String index); JsonObjGetter bulkUpdate(String index, String type, List<Object> allDoc, int retry_on_conflict); @SuppressWarnings("unchecked") T get(String index, String type, String id, Class<T> cls); @SuppressWarnings("unchecked") WSearchResult<T> searchObj(String index, String type, SearchQuery queryDSL, Class<T> cls); WPageIterator<T> search(String index, String type, SearchQuery queryDSL, Class<T> cls); Object indicesPutAlias(String index, String alias); boolean indicesDeleteAlias(String index, String alias); boolean hasIndex(String index); boolean hasIndexAlias(String index, String name); Set<String> getIndexTypes(String index); Set<String> getAllIndex(); Object createIndex(String index, int number_of_shards, int number_of_replicas); void reIndex(String oldIndex, String newIndex, boolean keepVersion); boolean delete(String index, String type, String id); DeleteByQueryResult deleteByQuery(String index, String type, Query query); T save(T doc); T index(T doc); T get(T doc); boolean delete(IEsItem doc); }
EsBaseService { public Object index(String index, String type, Object body) throws Exception { Index action = esHelper.index(index, type, null); action.setBody(body); return esHelper.post(action, Object.class); } EsBaseService(); void init(String server, OkHttpClient client, IConvert convert); Object getMapping(String index); Object getMapping(String index, String type); Object putMapping(String index, String type, Object mapping); Object getIndex(String index); Object putIndexSettings(String index, Object settings); Object index(String index, String type, Object body); Object index(String index, String type, String id, Object body); Object get(String index, String type, String id); boolean delIndex(String index); Object openIndex(String index); Object closeIndex(String index); Object syncedFlushIndex(String index); Object flushIndex(String index); JsonObjGetter bulkUpdate(String index, String type, List<Object> allDoc, int retry_on_conflict); @SuppressWarnings("unchecked") T get(String index, String type, String id, Class<T> cls); @SuppressWarnings("unchecked") WSearchResult<T> searchObj(String index, String type, SearchQuery queryDSL, Class<T> cls); WPageIterator<T> search(String index, String type, SearchQuery queryDSL, Class<T> cls); Object indicesPutAlias(String index, String alias); boolean indicesDeleteAlias(String index, String alias); boolean hasIndex(String index); boolean hasIndexAlias(String index, String name); Set<String> getIndexTypes(String index); Set<String> getAllIndex(); Object createIndex(String index, int number_of_shards, int number_of_replicas); void reIndex(String oldIndex, String newIndex, boolean keepVersion); boolean delete(String index, String type, String id); DeleteByQueryResult deleteByQuery(String index, String type, Query query); T save(T doc); T index(T doc); T get(T doc); boolean delete(IEsItem doc);  }