Skip to content

Instantly share code, notes, and snippets.

View SimpeTextField.js
import React, { Fragment } from "react";
export default props => {
const {
onChange,
validateField,
value,
error,
name,
validationText,
View FormField.js
import React from "react";
import FormContext from "./FormContext";
class FormField extends React.Component {
async componentDidMount() {
let { name, validators = [] } = this.props;
const { validateField, getFieldValue } = this.context;
// set default value
const newValue = getFieldValue({ name });
@royib
royib / compoundQuery.json
Last active Oct 28, 2019
Querying Elasticsearch- Compound query
View compoundQuery.json
{
"query": {
"bool": {
"must": {
"match": {
"mail_body": "Jeff BRidges"
}
},
"filter": {
"term": {
@royib
royib / termTextQuery.json
Created Oct 28, 2019
Querying Elasticsearch- Term-text query
View termTextQuery.json
{
"query": {
"term": {
"mail_from": "emma@somemail.com"
}
}
}
@royib
royib / FullTextQuery.json
Last active Oct 28, 2019
Querying Elasticsearch- Full-text query
View FullTextQuery.json
{
"query": {
"match": {
"mail_body": "Jeff BRidges"
}
}
}
@royib
royib / noScore.json
Created Oct 28, 2019
Querying Elasticsearch- no score at all
View noScore.json
{
"query": {
"bool": {
"filter": [
{
"term": { "gender": "female" }
},
{
"range": { "age": {"gte":"50"} }
}
@royib
royib / filterQueryContext.json
Last active Oct 28, 2019
Querying Elasticsearch- filter + query Context
View filterQueryContext.json
{
"query": {
"bool": {
"must": {
Leaf query clauses - affects the scoring of matching documents
},
"must_not" : {
Leaf query clauses - affects the scoring of matching documents
},
"should" : {
@royib
royib / filterContext.json
Created Oct 28, 2019
Querying Elasticsearch- filterContext
View filterContext.json
{
"query": {
"bool": {
"filter": {
"range": {
"age": {
"gte": 20,
"lte": 30
}
}
@royib
royib / queryContext.json
Last active Oct 28, 2019
Querying Elasticsearch- Query Context
View queryContext.json
{
"query": {
"bool": {
"must": [
{
"match": {
"street": "ditmas"
}
},
{
@royib
royib / projectDependenciesMongo.js
Created Oct 16, 2019
Node Clean Architecture - Frameworks-projectDependencies.js with mongoDb configuration
View projectDependenciesMongo.js
module.exports = (() => {
return {
DatabaseService: new MongoDBDatabaseServices(),
CrmServices: new UniversityCrmServices()
};
})();
You can’t perform that action at this time.