Indexing JSON

(Wojciech Pietrzak) #1

How I should proceed to index JSON documents from Lighthouse into Elasticsearch?

For example, when I try to index this


curl -XPOST -H "Content-Type: application/json" '' -d

I'm getting:

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"mapper [] of different type, current_type [long], merged_type [text]"}],"type":"illegal_argument_exception","reason":"mapper [] of different type, current_type [long], merged_type [text]"},"status":400}

(Zachary Tong) #2

It looks like the field "" was already indexed in Elasticsearch as a numeric long, but another document tried to index a string value. This can happen with auto-mapping which sees a number as the first value, even though the field is a string.

The best way to fix this is just to setup an explicit mapping on the index before starting to ingest documents. That way you can control the types of all the different fields.

(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.