![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
contexture-elasticsearch
Advanced tools
Elasticsearch Provider for Contexture
This provider takes a config object as a parameter, and expects a getClient
method to be provided, which should be an instantiated elasticsearch client.
This provider takes a config object as a parameter:
Option | Type | Description | Required |
---|---|---|---|
getClient | function | Returns an instantiated elasticsearch client | x |
request | object | Merged in the json body of every request to elasticsearch (e.g. to add custom headers) | |
types | object | Contexture node types, like all other providers |
Schemas with with an elasticsearch provider can specify any or all of the following properties:
Option | Type | Description | Required |
---|---|---|---|
index | string | Which ES index to use when querying | x |
type | string | Which ES type to use when querying | |
summaryView | function | Used by results to return a summary view instead of the whole document, (e.g. for indexes with many fields). Defaults to returning the hit property. | |
highlight | object | Used by results to determine what fields to highlight, and whether or not they are inline (copied over inline on to the source) or additional (in a list of additional fields that matched) |
module.exports = {
elasticsearch: {
index: 'SomeIndex',
type: 'SomeType'
}
}
let _ = require('lodash')
let Contexture = require('contexture')
let provider = require('contexture-elasticsearch')
let types = require('contexture-elasticsearch/types')
let schemas = require('./path/to/schemas')
let elasticsearch = require('elasticsearch')
let AgentKeepAlive = require('agentkeepalive'),
let process = Contexture({
schemas,
providers: {
elasticsearch: provider({
getClient: _.memoize(() =>
elasticsearch.Client({
// This is an example config, see the elasticsearch js docs for more
minSockets: 1,
maxSockets: 20,
keepAlive: true,
createNodeAgent: (connection, config) =>
new AgentKeepAlive(connection.makeAgentConfig(config))
})
),
request: {
headers: {
'custom-header-app-name': 'my-app-sent-this'
}
},
types: types({
geo: {
geocodeLocation: query =>
googleplaces.textSearch({
query
})
}
})
})
}
})
These types both filter and have contextual results.
facet
Facet represents a list of dynamic choices, e.g. a checkbox list filter.
Input
{
field: String,
mode: 'include|exclude', // Should this filter act as inclusion or exclusion of the values
values: Boolean, // What is checked
fieldMode: 'autocomplete|word|suggest', // Whether to look at the entire field (autocomplete), the analyzed words in the field, or magic suggestions. This generally means switching field/analyzers but abstracts that lower level es/index knowledge away from the client.
size: Number, // How many options to return
cardinality: Number, // Precision threshold override, defaults to 5000
includeZeroes: Boolean, // If true, it will include options with 0 matching documents (aka min_doc_count: 0)
optionsFilter: String, // Filters the options further, e.g. a find box above a checkbox list
caseSensitive: Boolean, // Whether options filter is case sensitive. Defaults to false. *no known usages*
sort: 'term|count'// Sort results alphabetically or by count of matching records
}
Output
{
cardinality: Number, // Cardinality (total number of options) for the field
options: [{
name: String,
count: Number
}]
}
geo
Represents a geographic radius search. Needs a geocodeLocation service passed in to it. Currently assumes it is a google maps geocoder search.
{
field: String,
location: String, // Location to geocode
radius: Number, // Radius in miles
operator: 'within|not within'
}
Result
{
place: GeocodeLocationResponse
}
The result can be used to show what location the server on a map, though in practice it's usually better to geocode on the client. This type is planned to be extended to support passing along raw lat/lng.
Filter only types just filter and nothing more. They don't have contextual results of their own.
bool
Bool represent a boolean check, e.g. a checkbox for true/false
{
field: String,
value: String|Boolean
}
date
Date represents a data range filter, with support datemath
{
field: String,
from: DateString|'thisQuarter|lastQuarter|nextQuarter', // Date string or one of three custom date math options
to: DateString,
useDateMath: Boolean // If true, it will parse dates as dateMath using @elastic/datemath
}
exists
Exists represents whether or not a field is present on results
{
field: String,
value: Boolean // Whether the field should exist or not
}
number
Number represents a number range with inclusive bounds. This type is planned to be extended to return contextual info on min, max, and histogram value distribution.
Some Notes:
{
field: String,
min: Number,
max: Number
}
query
Query represents a raw elasticsearch query_string.
{
field: String,
query: String, // The actual query
exact: Boolean // Represents opting out of stemming. Currently assumes the presence of an `.exact` subfield and analyzer. Defaults to false.
}
text
These types don't do any filtering of their own and only have results. These often power charts or analytics pages.
cardinality
dateHistogram
esTwoLevelAggregation
groupedMetric
matchCardinality
matchStats
nLevelAggregation
nonzeroClusters
percentileRanks
percentiles
percentilesRange
rangeStats
results
smartIntervalHistogram
smartPercentileRanks
statistical
terms
termsDelta
termsStatsHits
terms_stats
twoLevelMatch
FAQs
ElasticSearch Provider for Contexture
The npm package contexture-elasticsearch receives a total of 209 weekly downloads. As such, contexture-elasticsearch popularity was classified as not popular.
We found that contexture-elasticsearch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.