Giter Site home page Giter Site logo

dncrews / angular-elastic-builder Goto Github PK

View Code? Open in Web Editor NEW
83.0 83.0 38.0 765 KB

This is an Angular.js directive for building an Elasticsearch query. You just give it the fields and can generate a query for it.

License: Other

JavaScript 76.05% HTML 23.95%

angular-elastic-builder's People

Contributors

dncrews avatar oguennec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-elastic-builder's Issues

How to add our own dropdown conditions

For Example

Like term , I have a new variable i have to query

{
	"size": 0,
	"filter": {
		"and": [{
			"term": {
				"status": "failed"  // my own , can have multiple values (failed,passed,pending)
			}
		}]
	}
}

filter can not be applied

setting $scope.elasticQueryBuilder.query and $scope.elasticQueryBuilder.needsUpdate = true does not work.

I changed file dist/angular-elastic-builder.js, line 478 from

prev[choice] = truthy === (~group[key][obj.field].indexOf(choice));

to

prev[choice] = truthy === (group[key][obj.field].indexOf(choice) >= 0);

to fix it.

JSON output change

Hi,
how to change the JSON output when the rule is set, I dont want to send filter, size while forming json.
just wanted it to be .
sample json should be
Get rules

{
  "condition": "AND",
  "rules": [
    {
      "id": "price",
      "field": "price",
      "type": "double",
      "input": "text",
      "operator": "less",
      "value": "10.25"
    },
    {
      "condition": "OR",
      "rules": [
        {
          "id": "category",
          "field": "category",
          "type": "integer",
          "input": "select",
          "operator": "equal",
          "value": "2"
        },
        {
          "id": "category",
          "field": "category",
          "type": "integer",
          "input": "select",
          "operator": "equal",
          "value": "1"
        }
      ]
    }
  ]
}

Fix `needsUpdate`

If you don't put needsUpdate, the filters array never gets created...

Does this query-builder follow the suggested approach in terms of the query DSL for ES post ver. 2.X?

Thanks for a great project.
The more I read up on the changes in the Query DSL post version 2.0 ... it seems like 'and', 'or', 'all' and 'any' .. are being de-emphasised if not being deprecated altogether in favour of compound queries that use 'must', 'must_not', and 'should' that are wrapped as 'bool' queries (like below).

image

Are there plans to handle these types of 'new-breed' queries in this tool?

parsing_exception

hihi @dncrews i have use your example to build query like that

{
    "size": 10,
    "filter": {
        "and": [
            {
                "term": {
                    "appkey": "710659"
                }
            }
        ]
    }
}

and i receive error when using https://github.com/elastic/elasticsearch-js
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "Unknown key for a START_OBJECT in [filter].",
"line": 1,
"col": 21
}
],
"type": "parsing_exception",
"reason": "Unknown key for a START_OBJECT in [filter].",
"line": 1,
"col": 21
},
"status": 400
}

But when im modify the query like that, im fine

{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "appkey": "710569"
          }
        }
      ]
    }
  },
  "size": 10
}

so you can suggest me how can fix that when using your project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.