Hi,
I am creating Faq for organisation to enable elastic search in it . I would like to limit my search to each organisation. is it possible to add files and documents under one index so that i can filter according to organisation, so that by passing one index i will be able to only limit search documents and files in only that organisation. please provide a solution
Yes.
I don't really see what the question is though and how we can help.
see i need to create FAQ files which are searchable by individual organisations .each organisation creates its own FAQs which are uploaded in elastic cloud. if other organisation search for same content the search result should not be found ,only the content added by that organisation should be displayed in search. is there a method for me to add documents under each organisation and search under these organisations only
Yes.
POST /faq_comp1/_doc
{
"company": "1",
"content": "foo bar"
}
POST /faq_comp2/_doc
{
"company": "2",
"content": "foo bar"
}
Then
# Get all from company 1
GET /faq_comp1/_search
# Get all from company 1
GET /faq_comp2/_search
# Get all from all companies
GET /_search
Is that what you are asking for?
You can also look at aliases and filtered aliases and do something like:
POST /faq/_doc
{
"company": "1",
"content": "foo bar"
}
POST /faq/_doc
{
"company": "2",
"content": "foo bar"
}
If you create an alias faq_comp1
which filters on "company": "1"
and another one for the second company, you will be able to run:
# Get all from company 1
GET /faq_comp1/_search
# Get all from company 1
GET /faq_comp2/_search
# Get all from all companies
GET /_search
If you want to secure all that, you can secure you indices and your aliases with the built-in security.
is it possible to add many documents under a single index
like
POST /faq/_doc1
{
"company": "1",
"content": "content1"
}
POST /faq/_doc2
{
"company": "1",
"content": "content2"
}
so that i can get all documtes by GET /faq/_search
yes.
is it exactly as i have defined?? one index two docs
Thank you it works perfectly
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.