market
market copied to clipboard
Autocomplete tags in form
There are 2 steps here :
- create an autocomplete component
- use the component for tags in the publish form by passing to it a list of tags. I will provide a query in this issue to fetch all the tags , but it's currently not possible in aquarius
a list of tags can be easily fetched with the following query:
{
"from": 0,
"size": 0,
"aggs": {
"tags": {
"terms": {
"field": "metadata.tags.keyword"
}
}
}
}
result:
{
"_shards": {
"failed": 0,
"skipped": 0,
"successful": 2,
"total": 2
},
"aggregations": {
"tags": {
"buckets": [
{
"doc_count": 18,
"key": ""
},
{
"doc_count": 11,
"key": "test"
},
{
"doc_count": 4,
"key": "algo"
},
{
"doc_count": 2,
"key": "c2d"
},
{
"doc_count": 2,
"key": "example"
},
{
"doc_count": 1,
"key": "a"
},
{
"doc_count": 1,
"key": "aaa"
},
{
"doc_count": 1,
"key": "b"
},
{
"doc_count": 1,
"key": "data"
},
{
"doc_count": 1,
"key": "dataset"
}
],
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 13
}
},
"hits": {
"hits": [],
"max_score": null,
"total": {
"relation": "eq",
"value": 43
}
},
"timed_out": false,
"took": 4
}
For the autocomplete component would you be fine if we use the React-Select package?
Fine by me. We add a bit of custom css to make it look like the other inputs and it's wonderful