const getSearchResults = {
method: 'POST',
url: 'https://<IP>/graphql',
body: {
"operationName": "getSearchResults",
"variables": {
"search": {
"query": "first_name",
"type": "Fields",
"advanced": {}
},
"limit": 20,
"skip": 0,
"sort": "NameAsc"
},
"query": "query getSearchResults($search: MtEntitiesTCSearch, $skip: Int, $limit: Int, $sort: String) {\\n DataEntitiesSearch(search: $search, skip: $skip, limit: $limit, sort: $sort) {\\n logicalPath\\n type\\n name\\n description\\n note\\n parentId\\n dataSourceId\\n statistics {\\n fieldCount\\n resourceSize\\n commentCount\\n valueCount\\n nullCount\\n dateTimeCount\\n booleanCount\\n stringCount\\n numberCount\\n __typename\\n }\\n attributes {\\n fileFormat\\n avgUserRating\\n __typename\\n }\\n beAttributes {\\n resourceOrigin\\n sensitivity\\n virtualFolders {\\n _id\\n logicalPath\\n __typename\\n }\\n __typename\\n }\\n extraAttributes\\n dataVersion\\n displayName\\n schemaName\\n rowCount\\n tableCount\\n columnsCount\\n ordinalPosition\\n _id\\n timeOfLastChange\\n timeOfCreation\\n __typename\\n }\\n}\\n"
},
params: {
headers: { accept: '*/*',
'content-type': 'application/json',
'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"', },
},
};
const getSearchResultsCount = {
method: 'POST',
url: 'https://<IP>/graphql',
body: {
"operationName": "getSearchResultsCount",
"variables": {
"search": {
"query": "first_name",
"type": "Fields",
"advanced": {}
}
},
"query": "query getSearchResultsCount($search: MtEntitiesTCSearch) {\\n DataEntitiesSearchCount(search: $search)\\n}\\n"
},
params: {
headers: { accept: '*/*',
'content-type': 'application/json',
'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"', },
},
};
const getSearchFacets = {
method: 'POST',
url: 'https://<IP>/graphql',
body: {
"operationName": "getSearchFacets",
"variables": {
"search": {
"query": "first_name",
"type": "Fields",
"advanced": {}
}
},
"query": "query getSearchFacets($search: MtEntitiesTCSearch) {\\n DataEntitiesSearchFacets(search: $search)\\n}\\n"
},
params: {
headers: { accept: '*/*',
'content-type': 'application/json',
'sec-ch-ua': '".Not/A)Brand";v="99", "Google Chrome";v="103", "Chromium";v="103"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"', },
},
};
searchRT = http.batch([getSearchResults, getSearchResultsCount, getSearchFacets]); // to send the parallel requests we are using http batch
Search.add(searchRT.timings.duration);
Could anybody help me on this. Thanks in advance
Hi @sravani, welcome to the community forum!
It would’ve been nice to give us the actual error you got as well as 400
can mean many things .
An obvious thing that I can see is that given your replacement of the host with <IP>
- you are using https with IPs instead of hostnames which will not work great as k6(and not only) doesn’t know what hostname it needs to check in the certiciate.
Does your 400 dissapear if you add --insecure-skip-tls-verify
?
I would also expect that you need to JSON.stringify
your body
’s as they seem to be intended to be json but you leave them as objects.
Unrelated to your problem
Search.add(searchRT.timings.duration);
will not work as searchRT
is an array of responses each with a separate timings
. If you need the whole http.batch
combined - you will need to iterate over the array, sum them and then add tehm to Search
. If you need each separately - k6 already does this for you so no need for a separate metric.
Hope this helps you