Hello,
I am new to DotCMS. Absolutely a great product!
I have 2 queries regarding ES. I have searched the documentation and the group for an answer but no luck.
1) With native ES queries, we can limit the fields returned by ES using "_source" or "fields" parameters in the query. But apparently it does not work with /api/es/search. Sample:
{
"_source": ["Article.name", "Story.name"],
"query": {
"query_string" : {
"query" : "(Article.name:stress OR Story.name:stress)"
}
}
}
Result set still comes with all the available data and meta-data fields.
Is there any way to limit the fields returned? I need to limit the fields since I only need title field in the search results page on my frontend.
2) I've tried to use /api/es/raw instead but somehow it does not have full set of the fields in the result set, apparently only Id fields. For instance, the above query returns empty but if I change the query to a field agnostic one as below,
{
"query": {
"query_string" : {
"query" : "stress"
}
}
}
It returns 4 documents (as expected) but with these fields:
"max_score": 2.7379642,
"hits": [
{
"_index": "cluster_e7bwe1f0f3.working_20223223233",
"_type": "_doc",
"_id": "f9255af77b0eecwe03f5dc2604ff8a89_1",
"_score": 2.7379642,
"_source": {
"inode": "125762d1-539b-4we6b-989a-edfwe2ef198c",
"identifier": "f9255xcf77b0ewew8d03f5dc2604ff8a89"
}
},
Which is confusing because it means the relevant fields with "stress" word have been indexed but somehow result set does not have "name" fields ["Article.name", "Story.name"] of these two content types.
Could you please help me to understand what am I doing wrong?
Thank you.