# Ingest data and. fetch data through groovy in the. URL https://testsearch-cca1f6.ent.us-central1.gcp.cloud.es.io

**URL:** <https://discuss.elastic.co/t/ingest-data-and-fetch-data-through-groovy-in-the-url-https-testsearch-cca1f6-ent-us-central1-gcp-cloud-es-io/307463>\
**Category:** Elasticsearch\
**Created:** [June 17, 2022, 3:40am UTC](https://discuss.elastic.co/t/ingest-data-and-fetch-data-through-groovy-in-the-url-https-testsearch-cca1f6-ent-us-central1-gcp-cloud-es-io/307463 "2022-06-17T03:40:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pritam\_Thing](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pritam_thing/32/103308_2.png) [@Pritam\_Thing](https://discuss.elastic.co/u/Pritam_Thing)\
**Post date:** [June 17, 2022, 3:40am UTC](https://discuss.elastic.co/t/ingest-data-and-fetch-data-through-groovy-in-the-url-https-testsearch-cca1f6-ent-us-central1-gcp-cloud-es-io/307463/1 "2022-06-17T03:40:53Z")

</div>

Hey everyone, I want to ingest data dynamically though groovy and search through jquery .

While i was testing the search api, I found some issue related to cors.

Could someone help me out with the following code.

```
    var ElasticAppSearch = window.ElasticAppSearch;

	var client = ElasticAppSearch.createClient({
		searchKey: "search-qh41tgbe995ibx1bm8qzbh4e",
		endpointBase: "https://testsearch-cca1f6.kb.us-central1.gcp.cloud.es.io",
		engineName: "PA-SEARCH-ENGINE"

	});

	var options = {
		search_fields: { name: {} },
		result_fields: { id: { raw: {} }, title: { raw: {} } },
	};

	client.multiSearch([{ query: "Bisected", options }, { query: "Bisected", options }])
			.then(allResults => {
		allResults.forEach(resultList => {
			resultList.results.forEach(result => {
				console.log("Success");
});
});
})
.catch(error => {
		console.log(`error: `);
});
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 15, 2022, 3:41am UTC](https://discuss.elastic.co/t/ingest-data-and-fetch-data-through-groovy-in-the-url-https-testsearch-cca1f6-ent-us-central1-gcp-cloud-es-io/307463/2 "2022-07-15T03:41:02Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
