# Is elastic search the right technology for this task?

**URL:** <https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068>\
**Category:** Elasticsearch\
**Created:** [July 8, 2018, 9:37pm UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068 "2018-07-08T21:37:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BinaryIsPrimary](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/binaryisprimary/32/46210_2.png) [@BinaryIsPrimary](https://discuss.elastic.co/u/BinaryIsPrimary)\
**Post date:** [July 8, 2018, 9:37pm UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068/1 "2018-07-08T21:37:04Z")

</div>

I have a project where I have JSON documents which are like social media posts. They have tags, title, author, medias, location, etc. This is a concrete example of how the document could look like:

```
    {
		"id": "5af825e5-6a0e-46be-8680-3903018e3986",
		"caption": "This is a caption of a #sample #document.",
		"countComments": 0,
		"creationTime": 1530996262,
		"creator": 
		{
			"id": "46618d53-aec7-40d3-9d9f-3671e7de48d7",
			"followerCount": 213,
			"followsCount": 21,
			"lastUpdated": 1531082958,
			"mediaCount": 12,
			"profilePictureUrl": "https://url-to-profile-pic.jpg",,
			"url": "https://www.url.com/users/userXYZ/",
			"username": "userXYZ"
		},
		"downvotes": null,
		"location": 
		{
			labels: ["city", "country"],
			lat: 1.111111,
			lon: 2.222222,
			title: "location title"
		}
		"medias": [
			{
				"creationTime": 1530996262,
				"height": 640,
				"width": 640,
				"id": "7008863b-19d6-4a70-b3ec-19788e47aa4b",
				"score": 121,
				"thumbnailUrl": "https://url.com/media/thumbnail.jpg",
				"type": "IMG",
				"url": "https://url.com/media/mediaurl.jpg"
			}
		],
		"score": 1224,
		"comments": [],
		"tags": [
			"tagOne",
			"tagTwo",
			"tagThree",
			"tagFour",
			"tagFive",
			"tagSix"
		],
		"title": "title of the post",
		"upvotes": 217,
		"url": "https://www.url.com/posts/thispost"
	}

```

I am now looking for a document store with which I can run complex queries (meaning on arrays and number ranges for example) in a fast response time. This is a sample query which I want to execute:

```
    SELECT documents FROM store WHERE
		creationTime IS BETWEEN numberA and numberB
		AND likes IS BETWEEN numberC and numberD
		AND author.follower IS BETWEEN numberE and numberF
		AND location.labels CONTAINS "city"
		AND tags CONTAINS "tagOne" AND "tagTwo"
		LIMIT 16 OFFSET 0

```

I am well aware of the need of indexing the documents. The arrays are only strings, not complex (nested) objects.

The number of documents will potentially grow into the billions, so sharding the indexes and horizontal scaling is a must have. Optimally I want a response of under 5 seconds for a query like the above (which means big clusters).

Is elasticsearch capable or even an option for that task?

---

<div class="post-metadata">

**Author:** ![ddorian43](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddorian43/32/36093_2.png) [@ddorian43](https://discuss.elastic.co/u/ddorian43)\
**Post date:** [July 9, 2018, 2:08pm UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068/2 "2018-07-09T14:08:58Z")

</div>

Can you reduce `location.labels` into 1 array and not nested ? If yes, then you're good to go.

See [https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-search-speed.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-search-speed.html) for tuning for search.

---

<div class="post-metadata">

**Author:** ![BinaryIsPrimary](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/binaryisprimary/32/46210_2.png) [@BinaryIsPrimary](https://discuss.elastic.co/u/BinaryIsPrimary)\
**Post date:** [July 19, 2018, 8:50pm UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068/3 "2018-07-19T20:50:22Z")

</div>

Sure I can. Does that mean, that n number of trivial string arrays can be indexed and queried with near linear increase of query time? Or does the query time increase more than near linear with increasing number of trivial string arrays in the documents? For example, if I have 5 trivial string arrays in a document which I want to index and query, can I expect reasonable query times?

---

<div class="post-metadata">

**Author:** ![ddorian43](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ddorian43/32/36093_2.png) [@ddorian43](https://discuss.elastic.co/u/ddorian43)\
**Post date:** [July 20, 2018, 7:43am UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068/4 "2018-07-20T07:43:34Z")

</div>

Yep, `term` filters are the fastest. Index speed will depend on length of array, while search speed on number+length of terms that you're searching.

---

<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:** [August 17, 2018, 7:43am UTC](https://discuss.elastic.co/t/is-elastic-search-the-right-technology-for-this-task/139068/5 "2018-08-17T07:43:41Z")

</div>

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