Code Monkey home page Code Monkey logo

Comments (8)

spalger avatar spalger commented on May 17, 2024

Doesn't look like you are doing anything wrong. There is an error in the JSON, in the _source field... Can you try running the requests with curl to see if you get the same response body?

curl 'http://localhost:9200/places/snackbar/_search?pretty=true' -XPOST -d '{
  "query": {
    "match": {
      "heading": "het"
    }
  }
}'

from elasticsearch-js.

wires avatar wires commented on May 17, 2024

Good, I thought so. This is the curl output:

{
  "took" : 14,
  "timed_out" : false,
  "_shards" : {
    "total" : 3,
    "successful" : 3,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 0.19178301,
    "hits" : [ {
      "_index" : "places",
      "_type" : "snackbar",
      "_id" : "1",
      "_score" : 0.19178301, "_source" : {heading:"Het Geveltje", text: "Foo"}
    } ]
  }
}

I don't see a JSON error in the source field? Or do you mean that the error msg implies that there should be one?

from elasticsearch-js.

spalger avatar spalger commented on May 17, 2024

The heading and text keys need to be wrapped in quotes for it to be valid json

from elasticsearch-js.

spalger avatar spalger commented on May 17, 2024

What version of Elasticsearch are you running?

from elasticsearch-js.

spalger avatar spalger commented on May 17, 2024

Looks like you are indexing invalid JSON. Elasticsearch will still parse it sometimes, and when it succeeds it will return the original source to you. elastic/elasticsearch#586

Can you verify that this is the case?

from elasticsearch-js.

wires avatar wires commented on May 17, 2024

Running latest, 0.90.9. But indeed, that was the case, indexed invalid JSON! This was confusing though, missed those quotes. Thanks a lot!

from elasticsearch-js.

panthershark avatar panthershark commented on May 17, 2024

I ran into this today. We are using a river to load data. I deleted the indexes and the rivers, then re-added them and things were better.

Hopefully that helps others. This thread was very helpful for me.

from elasticsearch-js.

lilac avatar lilac commented on May 17, 2024

This helps me too.

from elasticsearch-js.

Related Issues (20)

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.