Create complex document and integration questions

I have watched both video and tried elastic search dashboard
i got few questions :

  1. i wish to let my search show multiple document, now i uploaded document json for products what is the best practice for adding other document and let user search query for all. like blog/article, posts, etc

  2. i have done search setting and tested query tester, is there any documentation for consume the api from frontend? i am using angular 9.

  3. i see when i typing keyword when testing search, each key is counted as search. is it setting in elastic cloud? or i need to fix it in my side later on frontend with angular 9?

  4. for documents upload for this testing we try using raw json, i see there are way to upload json file and using API to upload json files
    is it possible we just using API and send JSON data instead of json file from our own database / backend? so we dont need to generate json files. and is it good for us to keep sending new json everyday
    will it be a problem? is it count as traffic which will cost us?

thanks

Hi Wilson!

i wish to let my search show multiple document, now i uploaded document json for products what is the best practice for adding other document and let user search query for all. like blog/article, posts, etc

As long as all your document "types" are in the same engine, they will all be queryable by users. If you want users to be able to filter by a document "type", you can create a field that looks like this:

[
  { "type": "blog" },
  { "type": "article", }
  { "type": "post", }
]

And then when you're implementing your Search UI, you can create a checkbox/facet filter for the type field.

i have done search setting and tested query tester, is there any documentation for consume the api from frontend? i am using angular 9.

Our easiest way of consuming/quickly spinning up a frontend is going to be using Search UI (see the "Reference UI" link in the left sidebar), which completely handles creating a frontend for you. However, this uses React and not Angular 9 - so if you want to make use of Search UI within Angular 9, you'll have to be willing to dive into the core plumbing of our Search UI library:

If you'd rather skip Search UI totally and just use straight API endpoints, our documentation is here:

i see when i typing keyword when testing search, each key is counted as search. is it setting in elastic cloud? or i need to fix it in my side later on frontend with angular 9?

I can't see your screenshot, sorry, it leads to a login page. But if I'm understanding your question correctly, the answer is your last sentence - if you're fully implementing your own frontend, you should customize the debounce rate of how often queries are being sent to the API, which should in turn cut down on the number of recorded incomplete queries. debounceLength is also a customization option in Search UI (if you choose to use it) that you can pass in.

is it possible we just using API and send JSON data instead of json file from our own database / backend? so we dont need to generate json files.

Yes! You can absolutely send your documents in via API and just JSON, no need to generate JSON files.

and is it good for us to keep sending new json everyday will it be a problem?

It shouldn't be. This depends on your server/cluster sizes however. Make sure you have enough RAM/nodes/etc. to support the amount of processing power you need.

is it count as traffic which will cost us?

The answer to this question depends on whatever host you're using. If you're on Elastic Cloud, they charge by hosting resources, not by bandwidth or # of API calls, so just making a daily POST won't cost you extra. If you're self-hosting, you'll have to ask your provider about how they charge.

Hope that helped!

For the type in the document you mention
did you mean something like this
[
{ "type": "blog", "title": "title short text", "content": "Lorem Ipsum" },
{ "type": "product", "Name": "product name", "Category": "category 1 / category 1.1 / category 1.1.3" }
]

so each object can contain different elements?
am i correct ?

so each object can contain different elements?

Yes, your documents/JSON objects can contain almost* whatever elements (aka fields) you want. You get to determine your schema!

*caveats - fields must be lowercase/alphanumeric only, and cannot start with an underscore. There's a few reserved field names, but those are fairly rare and are listed here in our documentation: Documents API | App Search documentation [8.11] | Elastic