Comments (14)
Hi Alex, it is not possible now but definitely could be useful.
What would you say for providing the list which aggregations should be loaded in GET query (i.e. load_aggs=brand,model,tags
or load_aggs=
), is it ok ?
from itemsapi.
Great decision! The main thing that it affected the performance
from itemsapi.
For me, when i remove aggregation list from schema the time response is about 45 ms and with aggregation list this value is about 1,5 seconds And it would be cool to provide the list which aggregations should be loaded in GET query
from itemsapi.
Yeah, definitely. 1.5 seconds is too long if 45 ms is possible. I have it on my ToDo list. I will implement that probably by Friday. Is it "asap" for you ?
from itemsapi.
👍 Great!
from itemsapi.
@cigolpl it would be cool!
from itemsapi.
@athlonUA @pilot it is done. please let me know if that works for you
from itemsapi.
@cigolpl cool! i check it today!
from itemsapi.
hi @cigolpl If i make search with no aggregations like this /api/v1/items/products?load_aggs=
i receive the error like this
{
error: "Cannot read property 'category_tree' of undefined"
}
I receive this error when i make request with aggregation like /api/v1/items/products?load_aggs=brand
also.
From logs:
error: [TypeError: Cannot read property 'category_tree' of undefined] 'TypeError: Cannot read property \'category_tree\' of undefined\n at /var/www/example.com/node_modules/itemsapi/src/helpers/search.js:17:54\n at arrayMap (/var/www/example.com/node_modules/itemsapi/node_modules/lodash/index.js:1406:25)\n at Function.map (/var/www/example.com/node_modules/itemsapi/node_modules/lodash/index.js:6710:14)\n at getAggregationsResponse (/var/www/example.com/node_modules/itemsapi/src/helpers/search.js:16:24)\n at Object.searchConverter (/var/www/example.com/node_modules/itemsapi/src/helpers/search.js:107:23)\n at /var/www/example.com/node_modules/itemsapi/src/services/search.js:193:27\n at tryCatcher (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/promise.js:510:31)\n at Promise._settlePromise (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/promise.js:567:18)\n at Promise._settlePromise0 (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/promise.js:612:10)\n at Promise._settlePromises (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/promise.js:691:18)\n at Async._drainQueue (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/async.js:138:16)\n at Async._drainQueues (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/async.js:148:10)\n at Immediate.Async.drainQueues [as _onImmediate] (/var/www/example.com/node_modules/itemsapi/node_modules/bluebird/js/release/async.js:17:14)\n at processImmediate [as _immediateCallback] (timers.js:383:17)'
The collections.json
file i have
[
{
"name": "products",
"project": "example",
"schema": {
"brand": {
"type": "string",
"index": "not_analyzed"
},
"category_identificator": {
"type": "string",
"index": "not_analyzed"
},
"id": {
"type": "string",
"index": "not_analyzed"
},
"name": {
"type": "string"
}
},
"aggregations": [
{
"name": "category_tree",
"type": "terms",
"field": "category_identificator",
"size": 40,
"title": "Categories"
},
{
"name": "brand",
"type": "terms",
"field": "brand",
"size": 40,
"title": "Brands"
}
],
"table": {
"fields": [
"category_identificator",
"name",
"brand"
]
}
}
]
I also tried to remove category_tree
aggregation but the server show the error response
{
error: "Cannot read property 'brand' of undefined"
}
from itemsapi.
Hi Alex, thanks for feedback!
Could you temporary change your aggregations for:
"aggregations": {
"category_tree": {
"type": "terms",
"field": "category_identificator",
"size": 40,
"title": "Categories"
},
"brand": {
"type": "terms",
"field": "brand",
"size": 40,
"title": "Brands"
}
}
and see if /api/v1/items/products?load_aggs=brand
works now ?
from itemsapi.
Great! This works nice for now! 👍
from itemsapi.
Great but there can be a small problem. If you define aggregations
as an object
it works but your json response will be slightly different than with aggregations
as an array
and your app can stop working properly.
I've made a mistake some time ago introducing aggregations
as an array
because we need now to support both types in development and tests. It was my fault.
How is your app working with that new temporary configuration ?
from itemsapi.
All works perfectly, i didn't get any problems after defining aggregations as an object
from itemsapi.
Oo, that's really cool
from itemsapi.
Related Issues (20)
- add query_string to "similar items"
- make possible to disable specific aggregation from search result HOT 1
- Data searching HOT 8
- REST API endpoints HOT 2
- Sorting issue HOT 11
- throws error once aggregation ranges are empty (in generator)
- Make installation more intuitive HOT 1
- api keys
- Aggregation endpoint is not showing correct elements count HOT 1
- Improvement in new index name in reindex HOT 1
- Stop supporting non Elasticsearch field properties like display array
- Make field name analyzed in schema while generating project
- Elasticsearch 5.x HOT 5
- mysql support HOT 3
- Connect mysql table eample
- Start itemsapi docker HOT 2
- Documentation HOT 8
- AND vs OR HOT 2
- Multiple Indexes / Multitenancy HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itemsapi.